Display Lists not working
I am having some trouble with display lists not rendering at all. Here is the code
That code does nothing, but if I take the second piece of code and replace it with the first piece minus the display lists, it renders perfectly.
Any ideas?
Code:
for (i=0; i<objectCount; i++)
{
glNewList( object[i].list, GL_COMPILE );
glBindTexture(GL_TEXTURE_2D, texture[(ref[object[i].ref].texture)]);
glBegin( GL_TRIANGLES );
for (j=0; j<ref[object[i].ref].numTriangles; j++)
{
glTexCoord2f(ref[object[i].ref].vertex[ref[object[i].ref].triangle[j].vert[0]].u,ref[object[i].ref].vertex[ref[object[i].ref].triangle[j].vert[0]].v);
glVertex3f(object[i].vertex[ref[object[i].ref].triangle[j].vert[0]].x,object[i].vertex[ref[object[i].ref].triangle[j].vert[0]].y,object[i].vertex[ref[object[i].ref].triangle[j].vert[0]].z);
glTexCoord2f(ref[object[i].ref].vertex[ref[object[i].ref].triangle[j].vert[1]].u,ref[object[i].ref].vertex[ref[object[i].ref].triangle[j].vert[1]].v);
glVertex3f(object[i].vertex[ref[object[i].ref].triangle[j].vert[1]].x,object[i].vertex[ref[object[i].ref].triangle[j].vert[1]].y,object[i].vertex[ref[object[i].ref].triangle[j].vert[1]].z);
glTexCoord2f(ref[object[i].ref].vertex[ref[object[i].ref].triangle[j].vert[2]].u,ref[object[i].ref].vertex[ref[object[i].ref].triangle[j].vert[2]].v);
glVertex3f(object[i].vertex[ref[object[i].ref].triangle[j].vert[2]].x,object[i].vertex[ref[object[i].ref].triangle[j].vert[2]].y,object[i].vertex[ref[object[i].ref].triangle[j].vert[2]].z);
}
glEnd();
glEndList();
}Code:
glCallList(object[r].list);That code does nothing, but if I take the second piece of code and replace it with the first piece minus the display lists, it renders perfectly.
Any ideas?
did you use glGenLists() to generate the number? Also, remember that your target OpenGL context has to be setup before creating the list.
DoG Wrote:did you use glGenLists() to generate the number? Also, remember that your target OpenGL context has to be setup before creating the list.
Yeah, I forgot glGenList(). The funny thing is I forgot it somewhere else and it worked, so when I tried to look at my old code there was no glGenList and it was still working.
Thanks!
DoG Wrote:did you use glGenLists() to generate the number? Also, remember that your target OpenGL context has to be setup before creating the list.
Could you please elaborate on the term "openGL context" some more. Can't say
I've ever come across it in the Red Book or anywhere else. It sounds very
useful however. Is it just a matter of executing some commands?
There are some extra bits needed on top of the GL API in order to connect to the OS and window manager. One of those things is a context-- the chunk of state that all of your glEnable() etc settings are maintained in.
Read Apple's documentation for the Mac-specific info. The "OpenGL Overview>OpenGL Operation" section explains it all.
Read Apple's documentation for the Mac-specific info. The "OpenGL Overview>OpenGL Operation" section explains it all.
Maybe it just me, but I dislike technical documents that only explain the
what. Wish they would throw in how and why sometimes.
I believe this is the relvant passages. But it reads like a tautology:
"A context contains an entire OpenGL state environment. The context is an OpenGL client’s connection to the server. Your application may create multiple contexts, each with an entirely different OpenGL state. A specific context can be made current; OpenGL commands are processed by the current context. In Mac OS X, a context is current per-thread. Following the creation of a context with a pixel format, the context can be made current; OpenGL commands are then processed by the context, though no rasterization occurs until a drawable is attached."
Ok, what is an "entire OpenGL state environment" How does one make a context
current?
Maybe it is assumed that the entire document is read. But I'd like
a little more hand holding up front. End of rant.
what. Wish they would throw in how and why sometimes.
I believe this is the relvant passages. But it reads like a tautology:
"A context contains an entire OpenGL state environment. The context is an OpenGL client’s connection to the server. Your application may create multiple contexts, each with an entirely different OpenGL state. A specific context can be made current; OpenGL commands are processed by the current context. In Mac OS X, a context is current per-thread. Following the creation of a context with a pixel format, the context can be made current; OpenGL commands are then processed by the context, though no rasterization occurs until a drawable is attached."
Ok, what is an "entire OpenGL state environment" How does one make a context
current?
Maybe it is assumed that the entire document is read. But I'd like
a little more hand holding up front. End of rant.
Your rant is appropriate in the sense that yes, they don't tell you how to make the opengl context.
That said, there's a lot of ways to make an opengl context -- AGL, CGL, NSGL, GLUT, X11 (!) and probably more. They're aiming at generality, since to give an example for each setup would require too much space, and would duplicate information already existing in targeted documentation.
That said, there's a lot of ways to make an opengl context -- AGL, CGL, NSGL, GLUT, X11 (!) and probably more. They're aiming at generality, since to give an example for each setup would require too much space, and would duplicate information already existing in targeted documentation.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Display Lists and Obj. File Loader Problems | merrill541 | 0 | 1,655 |
Oct 17, 2008 06:42 PM Last Post: merrill541 |
|
| Display Lists or Vertex Arrays with texturing | seven | 6 | 3,315 |
Oct 17, 2005 09:24 AM Last Post: seven |
|
| Slowing Frame Rates and Display Lists | Nick | 4 | 2,689 |
Mar 27, 2005 06:08 AM Last Post: wadesworld |
|
| More display lists not working... | SOUR-Monkey | 1 | 2,142 |
Dec 8, 2004 09:11 PM Last Post: SOUR-Monkey |
|
| Will VBOs be faster than display lists for simple meshes? | TomorrowPlusX | 14 | 5,151 |
Nov 30, 2004 03:32 PM Last Post: arekkusu |
|

