# 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.

## 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 on other sites
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 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 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 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 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);

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 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 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 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 on other sites

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]

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013750
×