Sign in to follow this  
avance70

A Question About Polygon Count - How Much?

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
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
@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
Quote:
Original post by avance70ok 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?


any suggestions, plz?

Share this post


Link to post
Share on other sites
I rendered 1.2 Milions polygons on Geforce 6600 GT with all effects (HDR, bumpmapping, soft shadows, etc.) in realtime. Now rendering just several milions in realtime (could be probably much more - I'm gonna try 10 milions and more) on Radeon HD 2900 XT with effects like radiosity, own PCMLSM shadows (physically correct), dynamic reflections and refractions, 128-bit HDR, depth of field, advanced physics using AGEIA PhysX, and much more effects (see Desert Improved demo on this site in Image of the Day topics - well this demo has less polygons, but i've got some with much more polys) using OpenGL and own realtime raytracer and AGEIA NovodeX - PhysX.

Share this post


Link to post
Share on other sites
Quote:
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?

90% of the time youre gonna hit another bottleneck, before polygoncount becomes an issue
in your case im 99.999% sure fillrate is more of a problem. does FPS go up when u make the window smaller eg 320x240? if so then fillrate is a problem (not the number of polygons)

FWIW todays best cards can do from 1000 polygons a second to ~1billion polygons a second
it all depends on poygon size + amount of per vertex/fragment work



Share this post


Link to post
Share on other sites
Vertex Buffer Objects, or just simply VBOs, are the last word in efficient storage of vertex data. They allow you to directly store your vertices on graphics card accessible memory (VRAM or AGP) so that the driver can push them through the pipeline exceptionally fast.

They're fairly easy to use and [google] is always a good place to start looking.
I know that DevMaster has a brief, no-nonsense, walk-through of using VBOs.
Or NeHe has a more in-depth, but as usual, convoluted example.
And when you want to get more intimate then try here.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this