# Display List

I want to show my vertices with GLUspheres, to make them better visible. Therefore i created a display list.
void MyGLWidget::drawCircle (GLfloat x,GLfloat y,GLfloat z) {
glPushMatrix();
glTranslatef(x,y,z);
glCallList(circleList);
glPopMatrix();
}
The display list is created during the init:
void MyGLWidget::createCircleList (void) {
float radius = 15.0f;
int slices = 10;
int stacks = 10;
circleList = glGenLists(1);
glNewList (circleList, GL_COMPILE);
glEndList();
}
For each node i call the following code:
for(int i=0;i<numVertices;i++){
glBegin (GL_POINTS);
glVertex3f(vertices[i*3],vertices[i*3+1],vertices[i*3+2]);
if (bigVertices) {
drawCircle (vertices[i*3],vertices[i*3+1],vertices[i*3+2]);
}
glEnd();
}
But the speres are not drawen on the nodes?? What is wrong defined, or is there a better way to define visble nodes!

Thanks for your help
Juergen

Slight misunderstanding on how this all works! I’ll try and help here:

void MyGLWidget::drawCircle (GLfloat x,GLfloat y,GLfloat z) {
glPushMatrix();
glTranslatef(x,y,z);
glCallList(circleList);
glPopMatrix();
}
void MyGLWidget::createCircleList (void) {

float radius = 15.0f;
int slices = 10;
int stacks = 10;
circleList = glGenLists(1);
glNewList (circleList, GL_COMPILE);
glEndList();
}

For each node:

if ( bigVertices)
{
for(int i=0;i<numVertices;i++)
{
DrawCircle(vertices[i*3],vertices [i*3+1],vertices[i*3+2]);
}
}
else
{
glBegin ( GL_POINTS);
for(int i=0;i<numVertices;i++)
{
glVertex3f(vertices[i*3],vertices[i*3+1],vertices[i*3+2]);
}
glEnd ();
}

Also, I didn’t see you delete that quadric object after use? (memory leak?).

Hi Robbo!
Thanks for your reply! I made the changes like you sayed, but i can not see any spheres? Nothing is displayed at the vertex positions!
Juergen

Just out of curiosity, how exactly are your vertices being stored?

I note:

Vertices [i*3]
Vertices [i*3+1]
Vertices [i*3+2]

I am assuming your vertices are something like:

float Vertices [SOME LARGE NUMBER];

Try printing out or debugging say the first 5 or so vertex values (ie. floats 0 to 14) and paste them in here so we can have a look. They might be incorrect - .

Of course, you can always change the point size of the GL_POINTS in OpenGL.

I am sorry but the error was the too big radius !!
sorry
juergen