PDA

View Full Version : Display List Problems...



choi1012
05-28-2002, 03:26 PM
Hi.. Guys...
Help me...Plz!!

Why not draw and what is my problems?
It my psudo code...
--------------------------------------
// Class CGLDoc
#include "item.h"
class CGLDoc
{
...
CItem item;
...
}

void CGLDoc::OnFileOpen()
{
...
item.ReadItem();
...
}
---------------------------------------
// Class GLView
void GLView::OnPaint()
{
...
pDoc->item.draw();
...
}

---------------------
// Class CItem
class CItem
{
...
GLuint nList;
...
}

void CItem::ReadItem()
{
...
nList = glGenLists(1); // returns zero
glNewList(nList, GL_COMPILE);
glBegin(GL_LINES);
glVertex3d(0,0,0);
glVertex3d(1,1,1);
glEnd();
glEndList();
...
}

void CItem::draw()
{
...
glCallList(nList); // Not Draw...
...
}

-----------------------------------------

[This message has been edited by choi1012 (edited 05-28-2002).]

[This message has been edited by choi1012 (edited 05-28-2002).]

AndersO
05-29-2002, 03:59 AM
Well, the problem dont have to be with the displaylist itself.

Have you tried drawing the exact same line without displaylist?. Chances are that it wont show up then either!.

If so, then check where you are looking and where the line is.. http://www.opengl.org/discussion_boards/ubb/smile.gif

Deiussum
05-29-2002, 04:36 AM
Where are you putting your OpenGL initialization? If you're doing it in the OnCreate of your view, you should be ok. If you're doing it on OnInitialUpdate, then you may be trying to create your display list before you initialize OpenGL for the view.

Try this. Place a breakpoint at your glGenLists, and another one where you initialize OpenGL. If you hit the glGenLists breakpoint before you hit the OpenGL initialization, then there's your problem. You MUST have a Window initialized to use OpenGL before you can use any gl calls.