diff options
author | Phil Jones <philj56@gmail.com> | 2021-11-04 17:15:07 +0000 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2021-11-04 17:15:07 +0000 |
commit | 2eb3e98cc31bb8358e89784f967900827a5face3 (patch) | |
tree | f194bdb6d8e2bfc0cd3b15ebb8c4159fe4a7cfe5 | |
parent | 549ebd66bdf73817173fe36f5cc33e29f9a42574 (diff) |
Correct element buffer data type.
OpenGL ES 2 only allows byte or short indices in the element buffer, not
int.
-rw-r--r-- | src/gl.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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) |