PDA

View Full Version : Displaying only 1 triangle of a display list



jvff
06-10-2003, 12:41 PM
Hello,
I'm trying to load a model (very simple, just 2 triangles) and show it on screen. When I convert the data into a display list it's only displaying 1 of the triangles. After debugging it I found no errors, all the data is set, the drawing is putting the correct coordinates, etc. Can someone help me figure it out? The self extracting file is here (the site is case sensitive):
www.jvffprogramming.hpg.com.br/Files.exe (http://www.jvffprogramming.hpg.com.br/Files.exe)

ThanX in advance,

JVFF

peter.vullings
06-11-2003, 06:11 PM
I had a quick look at your code. It could be your draw routine:

void draw()
{
int index = getDrawable();

glRotatef(angleX, 1.0f, 0.0f, 0.0f);
glRotatef(angleY, 0.0f, 1.0f, 0.0f);
glRotatef(angleZ, 0.0f, 0.0f, 1.0f);
glBegin(GL_TRIANGLES);
glCallList(index);
glEnd();
}

What you are trying to do here is draw triangle primitives (GL_TRIANGLES). For this you need 3 points for each trinagle (3 for the first, 3 for the second etc).

Perhaps what you need to do is use the GL_TRIANGLE_LIST primitive. I believe that the triangles in your display list are in this format ?? This requires 3 points for the first triangle, and 1 additional point for each triangle after that.

Does this solve it?

jvff
06-12-2003, 01:51 PM
Well, actually I found a way around it. I made an array of the lists' indexes and the called

glCallLists(array, GL_UNSIGNED_INT, num_of_lists);

ThanQ for your reply :-)

JVFF