PDA

View Full Version : EXC_BAD_INSTRUCTION on glFlush



hockeyman
10-31-2012, 07:04 AM
I have code:


glLoadIdentity();
visibleRect = [self visibleRect];
glViewport(0, 0, NSWidth(visibleRect), NSHeight(visibleRect));
glMatrixMode(GL_PROJECTION);
glFrustum(NSMinX(visibleRect), NSMaxX(visibleRect), NSMinY(visibleRect), NSMaxY(visibleRect), 0.1, 100);
glTranslatef(0,0,zoomValue);
glClearColor(0.93, 0.93, 0.93, 1.0);
glClear(GL_COLOR_BUFFER_BIT);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, height);
glTexCoord2f(1.0f, 1.0f); glVertex2f(width, height);
glTexCoord2f(1.0f, 0.0f); glVertex2f(width, 0.0f);
glEnd();
glBindTexture(GL_TEXTURE_2D, 0);

glFlush(); //Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)


And I get Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) error at glFlush line.
Why does this error appears?

tonyo_au
10-31-2012, 03:07 PM
In OpenGL an error can be from some previousfunction call. Use glGetError at stratagic spots to limit the scope of functions that might be wrong