# Larger display lists slower than smaller ones?

This topic is 3758 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, i have successfully made a 3d environment which is created by cubes. Now when i draw the map with display lists, the drawing gets slower when i draw the map in bigger parts at once. I found out that the optimal size is about 6 quads at once. When i create a display list, it goes roughly something like this:
glNewList(list_start, GL_COMPILE);
for(howmany at once){
glColor3f(r, g, b);
glTexCoord2f(tx1, ty1); glVertex3f(vx1+x, vy1+y, vz1+z);
glTexCoord2f(tx2, ty2); glVertex3f(vx2+x, vy2+y, vz2+z);
glTexCoord2f(tx3, ty3); glVertex3f(vx3+x, vy3+y, vz3+z);
glTexCoord2f(tx4, ty4); glVertex3f(vx4+x, vy4+y, vz4+z);
glEnd();
}
glEndList();
list_start++;

And then i just call the lists like:
for(y){
for(x){
glCallList(list);
}
}

I counted the amount of quads which it is drawing currently, but even when the amount of quads remains same, it is still slower to render when i draw more quads at once with display list. I also tried to not use static coordinates for the quads by using glTranslatef() function in placing the quads in the map, but this method was even slower than the static coordinates. Any ideas what could be the best way to draw cube based maps? Drawing should be optimal for first person view modes.

##### Share on other sites
Have you thought of rendering the entire map and putting that as a display list and just use that display list instead of rendering it again?

##### Share on other sites
The map is huge, i wont be able to render it all at once and having 60fps.

But yeah i tried that too, and it was slower than rendering it in 6 quad pieces.

##### Share on other sites
move whatever doesn't need updating outside of the loop...

glNewList(list_start, GL_COMPILE);	glBegin(GL_QUADS);		glColor3f(r, g, b);		for(howmany at once){			glTexCoord2f(tx1, ty1); glVertex3f(vx1+x, vy1+y, vz1+z);			glTexCoord2f(tx2, ty2); glVertex3f(vx2+x, vy2+y, vz2+z);			glTexCoord2f(tx3, ty3); glVertex3f(vx3+x, vy3+y, vz3+z);			glTexCoord2f(tx4, ty4); glVertex3f(vx4+x, vy4+y, vz4+z);		}	glEnd();glEndList();list_start++;

##### Share on other sites
OMG, thanks for the tip! im having 60fps now when i render the whole map ^__^

I didnt know that affects so much! I have used that method once, but not with display lists...

Oh btw, im using GL_TRIANGLES in the map drawing too, would it be faster to convert those GL_TRIANGLES into GL_QUADS than calling GL_TRIANGLES and GL_QUADS separately? so i could make the fourth vertex into same position as the third is when i draw triangle as a quad.

Thanks again!

[Edited by - Emark on August 2, 2008 9:36:59 AM]

##### Share on other sites
Does it work when you TRY it?

##### Share on other sites
Do you have face culling enabled? That and frustum culling would most likely speed up your program.

##### Share on other sites
Quote:
 Original post by Splinter of ChaosDoes it work when you TRY it?What about a GL_TRIANGLE_STRIP?

Try what? Try to draw it in two parts GL_TRIANGLES and GL_QUADS ?
I havent tried that yet, since this works alright now. and its kinda hard to sort the polygons in the order so i dont want to waste time in that if i dont know does it help me at all in rendering speed.
Its working fine when i converted triangles into quads.
I havent tried GL_TRIANGLE_STRIP, never used that one...

Quote:
 Original post by PCNDo you have face culling enabled? That and frustum culling would most likely speed up your program.

I havent even heard about those things :)
Im using same kind system, which is kinda retarded, but it works, could be made better though. (so it draws about only those which i can see).

##### Share on other sites
Quote:
 Original post by Emarki dont want to waste time in that if i dont know does it help me at all in rendering speed.

GL_QUAD_STRIP and GL_TRIANGLE_STRIP do the same order of points, so no code needs to be changed between them. According to the code you've posted, you wouldn't have to spend much time at all testing them:

glNewList(list_start, GL_COMPILE);// No need to be in the for loop if they don't change accordingly.glColor3f(r, g, b);glBegin(GL_QUAD_STRIP );// Taken out of the for loop because a GL_QUAD_STRIP only needs two new points per quad.// This, out here, serves as a priming read.glTexCoord2f(tx1, ty1); glVertex3f(vx1+x, vy1+y, vz1+z);glTexCoord2f(tx2, ty2); glVertex3f(vx2+x, vy2+y, vz2+z);for(howmany at once){                // The order of these two lines was swapped to match how they'll be drawn.		glTexCoord2f(tx4, ty4); glVertex3f(vx4+x, vy4+y, vz4+z);		glTexCoord2f(tx3, ty3); glVertex3f(vx3+x, vy3+y, vz3+z);}glEnd();glEndList();list_start++;

And, on a more general level, I've found learning to do my own testing a very valuable activity. I haven't been able to test this particular thing myself because I haven't created anything demanding enough where I'd even notice a difference. The data I have collected is non-conclusive. But, on general, I can usually get answers quicker by test (maybe takes half an hour) than by relying on a forum (might take several hours, if at all). And, by playing with the test, I can answer questions I wouldn't have otherwise thought to ask!

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 9
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
633331
• Total Posts
3011394
• ### Who's Online (See full list)

There are no registered users currently online

×