diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-10-29 13:58:14 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-10-29 13:58:14 +0200 |
commit | 5476dd7d21875d68a4d957f441d34eee2a9e2b37 (patch) | |
tree | 87036daac6884287108535fed77f2cd100928d18 /src | |
parent | 14e3617736c63bd22b0785ad418acef825db221f (diff) |
Fix multiple vertex buffers using the same data
Need to call glVertexPointer/glTexCoordPointer/glColorPointer every time
we render.
Diffstat (limited to 'src')
-rw-r--r-- | src/gl.c | 2 | ||||
-rw-r--r-- | src/graphics/vertex_buffer.c | 1 | ||||
-rw-r--r-- | src/window/window.c | 2 |
3 files changed, 4 insertions, 1 deletions
@@ -82,6 +82,8 @@ int mgl_gl_load(mgl_gl *self) { { &self->glAttachShader, "glAttachShader" }, { &self->glGetUniformLocation, "glGetUniformLocation" }, { &self->glUniform2fv, "glUniform2fv" }, + { &self->glGetError, "glGetError" }, + { &self->glGetString, "glGetString" }, { NULL, NULL } }; diff --git a/src/graphics/vertex_buffer.c b/src/graphics/vertex_buffer.c index aa4fdbb..9203d63 100644 --- a/src/graphics/vertex_buffer.c +++ b/src/graphics/vertex_buffer.c @@ -104,6 +104,7 @@ void mgl_vertex_buffer_draw(mgl_context *context, mgl_vertex_buffer *vertex_buff context->gl.glBindTexture(GL_TEXTURE_2D, texture ? texture->id : 0); context->gl.glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer->id); + mgl_vertex_buffer_set_gl_buffer_pointers(context); context->gl.glDrawArrays(mgl_primitive_type_to_gl_mode(vertex_buffer->primitive_type), 0, vertex_buffer->vertex_count); context->gl.glBindBuffer(GL_ARRAY_BUFFER, 0); context->gl.glBindTexture(GL_TEXTURE_2D, 0); diff --git a/src/window/window.c b/src/window/window.c index f29b920..94756cd 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -103,8 +103,8 @@ static int mgl_window_init(mgl_window *self, const char *title, int width, int h context->gl.glEnable(GL_BLEND); context->gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); context->gl.glEnableClientState(GL_VERTEX_ARRAY); - context->gl.glEnableClientState(GL_COLOR_ARRAY); context->gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY); + context->gl.glEnableClientState(GL_COLOR_ARRAY); XWindowAttributes gwa; gwa.width = 0; |