Jump to content
  • Advertisement
Sign in to follow this  

Larger display lists slower than smaller ones?

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

If you intended to correct an error in the post then please contact us.

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);
	glBegin(GL_QUADS);
		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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by Splinter of Chaos
Does 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 PCN
Do 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 this post


Link to post
Share on other sites
Quote:
Original post by Emark
i 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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!