![]() ![]() GlVertexAttribPointer(0, 2, GL_FLOAT, false, 24 * sizeof(Float), 0) GlBufferData(GL_ARRAY_BUFFER, vertexData, GL_STATIC_DRAW) The batch.draw() method puts the sprites vertex data in a cpu side buffer and batch.update() uploads everything to the gpu with glBufferSubData.Īnd setting up the spritebatch looks as follows: glBindBuffer(GL_ARRAY_BUFFER, tmpVbo) Val loc = glGetUniformLocation(shaderProgram.program, "u_projView") Here is an example with one texture: val shaderProgram = ShaderProgram("assets/default.vert", "assets/ag") ![]() So I have 5 texture bindings, 5 draw calls, and one vertex buffer update per frame which is not really that much. For rendering I'm using only one shader which is bound once the application starts. I have about 5 different textures which I bind once per frame resulting in 5 draw calls. I update the vertex buffer every frame with glBufferSubData once and then draw everything with ``glDrawElements`. I'm drawing my sprites batched, meaning I have one dynamic vertex buffer and a static index buffer. So there are no 1000 fullscreen quads, which would be no real use case. ![]() The sprites themself are random generated in size. The textures I'm using are all power of 2 textures and don't exceed a size of 512x512. I'm wondering how drawing simple geometry with textures can eat up so much performance (below 60fps)? Even my good graphics card (GTX 960) can "only" draw up to 1000 sprites smoothly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |