stack overflow creating a vertex buffer?

Moderator
Posts: 133
Joined: 2008.05
Post: #1
Code:
//Initialize ARB
    glGenBuffersARB(1, &bufferIdentifier);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB, bufferIdentifier);
int bufferLength = m_maxParticles * 3 * 4 * sizeof(GLfloat);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, bufferLength, NULL, GL_STREAM_DRAW_ARB);
    GLenum er = glGetError();

It's producing an error value of 1283, which is 0x0503 and a GL_STACK_OVERFLOW error. Unless my math is off, what's going on here? It's not a memory error, and it shouldn't be, since even with 10000 particles that's only a half a megabyte, and with 128 megabytes of VRAM, that's not even a dent.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
the stack overflow can only come from glPushMatrix, I believe. Those calls aren't at fault. Use the OpenGL profiler's break on error functionality to find the real culprit.
Quote this message in a reply
Moderator
Posts: 133
Joined: 2008.05
Post: #3
Huh, yeah, you're right. I found a glPushMatrix in another part of my code that I accidentaly wrote glPushMatrix when I was trying to pop it back off. Odd thing is, it's never caused a problem and that bit of code has been in there since the beginning. Will a GL_STACK_OVERFLOW error just disallow any further stack manipulations instead of terminate the program?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
yup.

you should always check for GL errors at least once per frame.
Quote this message in a reply
Moderator
Posts: 133
Joined: 2008.05
Post: #5
How does glGetError determine which error it produces? If there are multiple errors, does it return the most recent or the most important(program terminating errors)?
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #6
There can be multiple errors flagged simultaneously. They are returned in unspecified order.
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #7
Check this spec and then this example code.

Basically, you need to call glGetError in a loop.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Vertex buffer generation and rendering iphone eliscool 2 2,736 Dec 17, 2008 05:57 PM
Last Post: ThemsAllTook
  New Apple Render to Vertex Buffer Sample OneSadCookie 13 7,557 Oct 15, 2006 01:10 AM
Last Post: OneSadCookie