Improve texture rendering by 75% using openGL VBO #213
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To improve rendering performance of textures we now store the texture vertices
in the same VBO buffer that we use for regular shape drawing.
We do have an added loop through all of the
verticesTextureIds, values,though the benchmark for pixel rendering is still showing the same 52fps as
before. So it seems like there's not a big impact there.
One thing to note is that we're now duplicating our vertices for textures as
we're not defining our own indices (textured objects have 6 vertices now,
rather than 4), rather using the default for GL_TRIANGLES. This is convenient
as we can use the same
GLDrawArrayscall for both triangles and textures.I did experiement with using
glDrawElementsInstancedBaseVertexfor renderingour textured objects to see if it would increase performance, but I couldn't
get it to render properly and performance seemed unchanged, so there doesn't
seem to big a big performance penalty of allocating the extra vertices.
I've added a benchmark for rendering tilesets, on the main branch I'm getting
16fps, with this patch the performance is now at 28fps, so 75% more frames per
second compared to before.
Lastly fix a bug where tilesets would throw an exception when rendering due to
a missing z value.