Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: OpenGL 3.1 stack overflow

  1. #11
    Intern Contributor
    Join Date
    Jun 2012
    Quote Originally Posted by Dan Bartlett View Post
    Having OpenGL calls in a destructor:
    Code :
    	glDeleteBuffers(1, &(this->vboId));
    	glDeleteBuffers(1, &(this->iboId));
    can sometimes cause problems depending on when the object is destroyed. The context could potentially have been destroyed already, there could be no context current, or a different context could be current to the one you expected. It may be better to have a brush::deleteBuffers() instead.
    It didn't seem to cause problems when I was only passing vertex position data, though. As soon as I pass vertex color data, either in the same VBO or in a seperate one, I get issues.
    Last edited by fiodis; 12-05-2012 at 12:20 PM.

  2. #12
    Intern Contributor
    Join Date
    Jun 2012
    It turns out the gl calls in the destructor were, actually, the problem. Once I moved all the appropriate glDelete calls inside their own Cleanup() function, and called that at the right time, the issue was resolved. Thanks everyone.

    And I'm not sure if every vec3 input is converted to a vec4 implicitly, but it seems like it would - after all, the shader doesn't know if the first vec3 you're passing to it is position or color data or something else.

  3. #13
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    It's good to hear your problem is resloved. I put a macro after every OpenGL call that resolves to a check on current context and OpenGL error check in debug mode and nothing in release. It makes the code run a bit slower but helps catch some of these things.

    I am looking forward to the callback error code working the new drivers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts