Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve VBO rendering efficiency #1207

Open
wants to merge 1 commit into
base: SteamEngine
Choose a base branch
from

Conversation

SpexGuy
Copy link
Contributor

@SpexGuy SpexGuy commented Apr 5, 2015

by removing unnecessarily repeated driver calls

@daid
Copy link
Owner

daid commented Apr 5, 2015

How is this more efficient?

@SpexGuy
Copy link
Contributor Author

SpexGuy commented Apr 6, 2015

The major efficiency change is on line -210/+211, where the call to glBindBuffer(GL_ARRAY_BUFFER, 0) is moved out of the loop. This removes just under half the calls to bind to GL_ARRAY_BUFFER.
For clarity, the calls to glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ...) have been moved out of the loop. But since the loop only executes once in this case, this is not an efficiency improvement.
The calls to glEnableClientState(GL_NORMAL_ARRAY) have been moved to the top, so as to be in the same scope as glDisableClientState(GL_NORMAL_ARRAY). Again this doesn't improve efficiency, but I would argue that it does improve readability, and make the symmetry of the code more obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants