Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: how to handle GL_STACK_OVERFLOW?

  1. #1
    Guest

    how to handle GL_STACK_OVERFLOW?

    Dear sirs,
    I get GL_STACK_OVERFLOW error when I pan oe zoom the window, I know that is there is more objects than OpenGL can handle. but how to clear this error, will you please help me? thank you

    Diego_Jian

  2. #2
    Intern Newbie
    Join Date
    Aug 2003
    Location
    asda
    Posts
    47

    Re: how to handle GL_STACK_OVERFLOW?

    Originally posted by Diego_Jian:
    I know that is there is more objects than OpenGL can handle.
    No, its a stack overflow. Probably do your code has a glPushMatrix without any corresponding glPopMatrix.
    asd

  3. #3
    Junior Member Regular Contributor
    Join Date
    Sep 2001
    Location
    Eastern USA
    Posts
    218

    Re: how to handle GL_STACK_OVERFLOW?

    In the program I'm developing on the side, I had to deal with this recently. Some of my code is very liberal with pushing the projection matrix stack, which is usually rather short (on my Geforce 3, height of 4 matrices.)

    I made up for this by initializing a counter to the value of GL_MAX_PROJECTION_STACK_DEPTH-1 (since the active matrix is "on the stack" too) and subtracted 1 whenever I called a function that required pushing and added 1 to a max of GL_MAX_PROJECTIONSTACK_DEPTH-1 when I popped. If the value reached zero and I tried to push, I would retrieve the active matrix via glGetDoublev, and push it onto an std::stack designed to hold matrices. The value would then drop below zero. A pop attempt with a value less than zero indicated that I should pop the top matrix from that stack and then just shove it into OpenGL with glLoadMatrixd.

  4. #4
    Guest

    Re: how to handle GL_STACK_OVERFLOW?

    yes, u r right! thank you!!

    Originally posted by Some guy:
    No, its a stack overflow. Probably do your code has a glPushMatrix without any corresponding glPopMatrix.


Posting Permissions

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