PDA

View Full Version : Why the display list doesn't work?



martianfighter
11-21-2001, 07:49 PM
Hello,Everybody!
I found a strange question in my app. I created two display lists:RULER_LIST & INFO_lIST:

void CTestView::MakeList()
{
glNewList(RULER_LIST,GL_COMPILE);
CreateRulerList();
glEnd();

glNewList(INFO_LIST,GL_COMPILE);
CreateInfoList();
glCallList(RULER_LIST);
glEndList();
}
When I use glCallList(INFO_LIST),the screen is blank! But When I delete the code of creating the RULER_LIST,the other part of INFO_LIST is visible. I don't know why?
Please help me. Thanks!

Tron
11-21-2001, 08:50 PM
Originally posted by martianfighter:
Hello,Everybody!
I found a strange question in my app. I created two display lists:RULER_LIST & INFO_lIST:

void CTestView::MakeList()
{
glNewList(RULER_LIST,GL_COMPILE);
CreateRulerList();
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
glEndList();
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!

glNewList(INFO_LIST,GL_COMPILE);
CreateInfoList();
glCallList(RULER_LIST);
glEndList();
}
When I use glCallList(INFO_LIST),the screen is blank! But When I delete the code of creating the RULER_LIST,the other part of INFO_LIST is visible. I don't know why?
Please help me. Thanks!

[This message has been edited by Tron (edited 11-21-2001).]

[This message has been edited by Tron (edited 11-22-2001).]

Bob
11-22-2001, 04:07 AM
You probbaly change some states in RULER_LIST which are not restored, and in turn affects INFO_LIST in a negative way. An example can be translations. You translate RULER_LIST, but don't restore this translation before ending the list. This means that you have unwanted translation in INFO_LIST which causes the object to appear somewhere else (outside your window perhaps).

svg
11-24-2001, 08:07 AM
Your code of RULER_LIST:

glNewList(RULER_LIST,GL_COMPILE);
CreateRulerList();
glEnd();

ends with the wrong procedure, its the procedure to end a GLBEGIN(), not a GLNEWLIST. The GLEND would be the procedure of terminating GLNEWLIST():

GLENDLIST;

The INFO_LIST cant be drawn because you are still in the RULER_LIST. understand.

good luck