From 2eb3e98cc31bb8358e89784f967900827a5face3 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Thu, 4 Nov 2021 17:15:07 +0000 Subject: Correct element buffer data type. OpenGL ES 2 only allows byte or short indices in the element buffer, not int. --- src/gl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gl.c') diff --git a/src/gl.c b/src/gl.c index 897ff63..8937d41 100644 --- a/src/gl.c +++ b/src/gl.c @@ -31,7 +31,7 @@ void gl_initialise(struct gl *gl, struct image *texture) glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glDebugMessageCallback(MessageCallback, 0); #endif - if (texture == NULL) { + if (texture == NULL || texture->buffer == NULL) { return; } @@ -92,7 +92,7 @@ void gl_initialise(struct gl *gl, struct image *texture) * Create the element buffer object that will actually be drawn via * glDrawElements(). */ - GLuint elements[] = { + GLubyte elements[] = { 0, 1, 2, 2, 3, 0 }; @@ -173,7 +173,7 @@ void gl_draw_texture( } glViewport(x, y, width, height); - glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0); } void load_shader(GLuint shader, const char *filename) -- cgit v1.2.3