Jump to content
  • Advertisement
Sign in to follow this  
avance70

A Question About Polygon Count - How Much?

This topic is 3973 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

i have approximately 15000 quads which i draw on the screen it works around 20-30FPS on my computer (p4, 3ghz, 7600gt) is that good? i mean should that many polygons be drawn more quickly? should my code be more optimized? the code is like this: for(byte y=0; y<100; y++) for(byte x=0; x<150; x++) { GL.glColor3f(TR[x][y], TG[x][y], TB[x][y]); GL.glVertex3f(TX[x][y], TY[x][y], TZ[x][y]); GL.glColor3f(TR[x+1][y], TG[x+1][y], TB[x+1][y]); GL.glVertex3f(TX[x+1][y], TY[x+1][y], TZ[x+1][y]); GL.glColor3f(TR[x+1][y+1], TG[x+1][y+1], TB[x+1][y+1]); GL.glVertex3f(TX[x+1][y+1], TY[x+1][y+1], TZ[x+1][y+1]); GL.glColor3f(TR[x][y+1], TG[x][y+1], TB[x][y+1]); GL.glVertex3f(TX[x][y+1], TY[x][y+1], TZ[x][y+1]); } im thinking into making it into a game, should i increase or decrease the polygon count? [Edited by - avance70 on January 31, 2008 9:15:14 AM]

Share this post


Link to post
Share on other sites
Advertisement
you should at least look into arrays, if not some of the other techniques like buffer objects and display lists. because there is overhead for each function call you make.

Share this post


Link to post
Share on other sites
yes, i am planning to use video card memory, but not just yet - im still learning

and thanks about the display list suggestion, it should be very useful!

but im unsure what you mean with: i should look into arrays?

Share this post


Link to post
Share on other sites

Hi,

15000 quads equals 30k triangles which isn't much (at least at 20-30 fps) unless there is plenty of pixel over draw. This equals like 600k-900k triangles per second. Considering that your hardware should be able to push (theoretically) at least 100+ million triangles per second, you should look into using vertex buffers / indexed primitives or so.

Regards!

Share this post


Link to post
Share on other sites
You have a few options to speed that up dramatically. You should be able to draw hundreds of thousands of triangles per frame with that card for static geometry (it'll probably be a bit slower where it's animated).

- One option is vertex arrays - glDrawArrays() .

- Another option is using a display list.

Share this post


Link to post
Share on other sites
tnx all ive done this:

in the class definition i added:

public int box=0;

then i defined this:

box=GL.glGenLists(1);
GL.glNewList(box, GL.GL_COMPILE);
GL.glBegin(GL.GL_QUADS);

for(byte y=0; y<100; y++)
for(byte x=0; x<150; x++)
{
GL.glColor3f(TR[x][y], TG[x][y], TB[x][y]);GL.glVertex3f(TX[x][y], TY[x][y], TZ[x][y]);
GL.glColor3f(TR[x+1][y], TG[x+1][y], TB[x+1][y]);GL.glVertex3f(TX[x+1][y], TY[x+1][y], TZ[x+1][y]);
GL.glColor3f(TR[x+1][y+1], TG[x+1][y+1], TB[x+1][y+1]);GL.glVertex3f(TX[x+1][y+1], TY[x+1][y+1], TZ[x+1][y+1]);
GL.glColor3f(TR[x][y+1], TG[x][y+1], TB[x][y+1]);GL.glVertex3f(TX[x][y+1], TY[x][y+1], TZ[x][y+1]);
}

GL.glEnd();
GL.glEndList();

and when i draw it - instead of calling the beforementioned for loops - i just called:

GL.glCallList(box);

but there's nothing on the screen? did i miss something?

[Edited by - avance70 on January 31, 2008 9:55:43 AM]

Share this post


Link to post
Share on other sites
if nobody knows whats wrong,
could someone point me to any opengl DISPLAY LIST C# EXAMPLE file?

notes:
-ive used the basecode from: http://nehe.gamedev.net/ to develop my app
-i am using c# (visual studio 2008) and the downloadable example(s) found here: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=12 are not working for me

Share this post


Link to post
Share on other sites
You're probably creating the displaylist when the array isn't filled...try this:



int box=0;

void render() //this is your renderloop...
{
if (box==0)
{
box = glGenLists(1);
glNewList(box,GL_COMPILE);
for(byte y=0; y<100; y++)
for(byte x=0; x<150; x++)
{
GL.glColor3f(TR[x][y], TG[x][y], TB[x][y]); GL.glVertex3f(TX[x][y], TY[x][y], TZ[x][y]);
GL.glColor3f(TR[x+1][y], TG[x+1][y], TB[x+1][y]); GL.glVertex3f(TX[x+1][y], TY[x+1][y], TZ[x+1][y]);
GL.glColor3f(TR[x+1][y+1], TG[x+1][y+1], TB[x+1][y+1]); GL.glVertex3f(TX[x+1][y+1], TY[x+1][y+1], TZ[x+1][y+1]);
GL.glColor3f(TR[x][y+1], TG[x][y+1], TB[x][y+1]); GL.glVertex3f(TX[x][y+1], TY[x][y+1], TZ[x][y+1]);
}
glEndList();
}
else
glCallList(box);
}





If this doesn't work, then re-do your code from scratch, since it's most likely broken in some other place. :)

/Robert

Share this post


Link to post
Share on other sites
You should use vertex arrays since your data is already stored in an array. Maybe this will help...

http://opengl.org/documentation/specs/version1.1/glspec1.1/node21.html

Share this post


Link to post
Share on other sites
@Rasmadrak:

even though array was defined, i followed that suggestion and managed to find out that the problem was that i was storing the object to the list before i set the current context.

@DariusBoone:
that suggestion looks nice. but i dont quite understand it all. is there any simple C#/C++ example i can look at?

* * *

ok so lets get back to the main subject of the theme:
how many polygons can a today's regular computer draw per second? though, i dont even know what a regular computer is ;) perhaps some p4/amd with 6600GT/7600GS?

[Edited by - avance70 on February 1, 2008 2:22:57 AM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!