UPDATE: Called when vertex data changes (on each frame). GlUniformMatrix4fv(.) // Identify shader uniforms. GlUseProgram(.) // Use program with custom shaders. GlEnableVertexAttribArray(.) // Setup vertex attributes. GlBufferData(GL_ELEMENT_ARRAY_BUFFER.) // Pass index values 0 - (UPPER-1). GlBufferData(GL_ARRAY_BUFFER.) // Pass vertex data for UPPER vertices. I pass the GL_STREAM_DRAW usage hint to each glBindBuffer call to indicate the data changes each frame.Īttempting to be as efficient as possible, I created the following setup: // SETUP: Called only once. I malloc my vertex and index data arrays only once at startup based on this value. ![]() Following advice received here earlier, I now specify integer UPPER as an upper bound on the number of vertices which will ever be drawn. In one frame I may have 1000 and in the next 2500. ![]() The actual number of vertices to be drawn changes rapidly over time. The reason is that calculating the vertex positions from scratch is costly, but a delta can be added to the last position to cheaply update it. I have a set of vertex data which is permanently stored in normal RAM. I'm using a Vertex Buffer Object (VBO) in OpenGL ES 2.0.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |