ref: ff5a0189e096e029acf107b9a1268f1791221bc7
parent: 350ba46f2e9e3f13c8a9a22c2248f4d8aa0d732c
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Jul 31 18:50:14 EDT 2019
OpenGL: Ditch index buffer Seems completely unnecessary for 2D
--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -210,13 +210,6 @@
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_id);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_buffer), NULL, GL_DYNAMIC_DRAW);
- // Set up Index Buffer Object
- const GLuint indices[4] = {0, 1, 2, 3};
- GLuint index_buffer_id;
- glGenBuffers(1, &index_buffer_id);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_id);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
-
// Set up the vertex attributes
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (GLvoid*)offsetof(VertexBuffer, vertexes));
@@ -297,7 +290,7 @@
vertex_buffer.vertexes[3][1] = 1.0f;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertex_buffer), &vertex_buffer);
- glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
SDL_GL_SwapWindow(window);
@@ -399,7 +392,7 @@
vertex_buffer.vertexes[3][1] = vertex_bottom;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertex_buffer), &vertex_buffer);
- glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key)
@@ -453,7 +446,7 @@
vertex_buffer.vertexes[3][1] = vertex_bottom;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertex_buffer), &vertex_buffer);
- glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
@@ -602,7 +595,7 @@
vertex_buffer.vertexes[3][1] = vertex_bottom;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertex_buffer), &vertex_buffer);
- glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)