Baffling GL error
I've been trying to track down an error state in my game engine, so I told OpenGL Profiler to break on error.
So, the odd thing is that I'm getting an error for glGenLists.
This doesn't make any sense to me. The actual code is this:
Now, printf'ing the value of _dListID I see what looks like a valid display list name. Also, according to the manpage, glGenLists should only create the invalid value error state if the passed in number of names is less than zero.
According to the manpage:
As far as I can tell, this is the *first* error state, since GL Profiler lets the program run happily up to this point. That is to say, game menus, progress loading indicators, etc all draw fine. It breaks on the first drawing frame of the actual game, when I create the display list.
Also, it should be said that the game *runs* fine, so long as I'm not breaking on GL Error. And, one more thing, I'm using glew ( glew.sf.net ) to manage GL extensions.
Any ideas?
So, the odd thing is that I'm getting an error for glGenLists.
Code:
glGenLists()
Error: GL_INVALID_VALUE
Context: <not available>
Function call stack:
0: gloTerminateLibrary <GLProfiler>
1: gloGetCGLDispatch <GLProfiler>
2: Mesh::Geometry::draw() <Legion> /Users/zakariya/Projects/Legion/src/Core/Mesh/Mesh.cpp: 314
3: Mesh::Entity::draw() <Legion> /Users/zakariya/Projects/Legion/src/Core/Mesh/Mesh.cpp: 865
4: Legion::ColonyPart::display(float) <Legion> /Users/zakariya/Projects/Legion/src/Core/Environment/Colony.cpp: 558
5: Legion::SceneNode::display(float) <Legion> /Users/zakariya/Projects/Legion/src/Core/SceneGraph.cpp: 433
6: Legion::SceneGraph::display(float) <Legion> /Users/zakariya/Projects/Legion/src/Core/SceneGraph.cpp: 792
7: Legion::Stage::displayLit(float) <Legion> /Users/zakariya/Projects/Legion/src/Core/Stage.cpp: 742
8: Legion::Stage::display(float) <Legion> /Users/zakariya/Projects/Legion/src/Core/Stage.cpp: 711
9: Legion::LegionGame::displayStage(float) <Legion> /Users/zakariya/Projects/Legion/src/Legion/LegionGame.cpp: 392
10: Legion::DecalTestState::display(float) <Legion> /Users/zakariya/Projects/Legion/src/Legion/States/Tests/DecalTestState.cpp: 76
11: Legion::GameWorld::display(float) <Legion> /Users/zakariya/Projects/Legion/src/Core/GameWorld.cpp: 141
12: Legion::LegionGame::display(float) <Legion> /Users/zakariya/Projects/Legion/src/Legion/LegionGame.cpp: 154
13: GSEventDisplay <Legion> /Users/zakariya/Projects/Legion/src/GameShell/GSEvents.mm: 80
14: -[GSOpenGLView drawRect:] <Legion> /Users/zakariya/Projects/Legion/src/GameShell/GSOpenGLView.m: 128
15: 0x92dc7c2c
16: 0x92dd8670
17: 0x92e0e3d0
18: 0x9019f16c
19: 0x92dd8774
20: 0x92dc3f44
21: 0x92dc4360
22: 0x92e10ef0
23: 0x92df808c
24: 0x92dd5244
25: 0x92dee274
26: 0x909f30e4
27: 0x901945f8
28: 0x90191958
29: 0x90195e6c
30: 0x927d5f60
31: 0x927dc6c8
32: 0x927fe6a0
33: 0x92dd2e44
34: 0x92de98c8
35: 0x92dfdc30
36: 0x92eba2b8
37: main <Legion> /Users/zakariya/Projects/Legion/src/main.m: 13
38: _start <Legion> /SourceCache/Csu/Csu-47/crt.c: 267
39: _dyld_start <dyld>This doesn't make any sense to me. The actual code is this:
Code:
void Geometry::draw( void )
{
if ( _immediateMode )
{
_draw();
}
else
{
if ( !_dListID )
{
_dListID = glGenLists(1); // <-- glError here
glNewList( _dListID, GL_COMPILE );
_draw();
glEndList();
}
glCallList( _dListID );
}
}Now, printf'ing the value of _dListID I see what looks like a valid display list name. Also, according to the manpage, glGenLists should only create the invalid value error state if the passed in number of names is less than zero.
According to the manpage:
Code:
GL_INVALID_VALUE is generated if range is negative.
GL_INVALID_OPERATION is generated if glGenLists is executed between the execution of glBegin and the corresponding execution of glEnd.As far as I can tell, this is the *first* error state, since GL Profiler lets the program run happily up to this point. That is to say, game menus, progress loading indicators, etc all draw fine. It breaks on the first drawing frame of the actual game, when I create the display list.
Also, it should be said that the game *runs* fine, so long as I'm not breaking on GL Error. And, one more thing, I'm using glew ( glew.sf.net ) to manage GL extensions.
Any ideas?

