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

lecture_viewing3d - Mesh & GL_ELEMENT_ARRAY_BUFFER #10

Closed
RobertLeahy opened this issue Nov 6, 2015 · 1 comment
Closed

lecture_viewing3d - Mesh & GL_ELEMENT_ARRAY_BUFFER #10

RobertLeahy opened this issue Nov 6, 2015 · 1 comment

Comments

@RobertLeahy
Copy link
Contributor

In lecture_viewing3d, in the Mesh::init method on line 61 a buffer object is bound to the GL_ELEMENT_ARRAY_BUFFER target. This is never undone, nor is it redone in Mesh::draw.

By sheer chance nothing else is ever bound to this target so the code works, but if anyone uses this as a baseline/reference for anything in a more complicated system they're probably going to have quite the time finding the bug.

@taiya
Copy link
Owner

taiya commented Nov 11, 2015

Thanks Robert, the same will be true for a number of other calls :)
Our example code is not very rigorous in terms of memory clean-up and buffer unbinding.

A much better way of doing this would be by implementing a class that unbinds when the object falls out of scope. But in previous years students complained that by giving them a game-engine like framework they didn't learn anything of OpenGL. That's why the code it's the way it is now. It's a compromise!

@taiya taiya closed this as completed Nov 11, 2015
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

No branches or pull requests

2 participants