Advertisement

opengl performance with geforce 1 in immediate mode ?

Started by January 22, 2002 01:55 AM
1 comment, last by nitzan 23 years, 1 month ago
Ok, so I have the following code: glPushMatrix(); glEnable(GL_CULL_FACE); glTranslatef(10.0, 0.0, -100.0f); for(int i=0; i<4000; i++) { glTranslatef(0.0, 0.0, -1.0f*i); glBegin(GL_QUADS); glNormal3f(0, 0, 1); glTexCoord2f(0, 0); glColor3f(1.0f, 0.0f, 1.0f); glVertex3f(-5, -5, 0); glNormal3f(0, 0, 1); glTexCoord2f(0, 1); glColor3f(1.0f, 1.0f, 0.0f); glVertex3f(5, -5, 0); glNormal3f(0, 0, 1); glTexCoord2f(1, 1); glColor3f(0.0f, 1.0f, 1.0f); glVertex3f(5, 5, 0); glNormal3f(0, 0, 1); glTexCoord2f(1, 0); glColor3f(0.0f, 1.0f, 0.0f); glVertex3f(-5, 5, 0); glEnd(); } glDisable(GL_CULL_FACE); glPopMatrix(); I am getting only 400,000 Triangle Per Second (8000 triangles and around 50fps). If I only call glNormal and glColor once then I get 480,000 TPS. If I use display lists I get around 4,000,000 TPS. I dont want to use display lists because my data will actually be changing. Is there another way to speed things up ? Vertex arrays seem to make it slower since its just 2 damn triangles. This will be part of a large quad-tree structured landscape so I cant put the triangles into a big array. Any ideas ? Using GL_TRIANGLE_STRIP gives the exact same performance. This is on a P3 800 with a Geforce 1 DDR 32mb running in a window at 1024x768x16 on a 1280x1024x32 desktop. Full screen gives me 512,000 TPS (instead of 400,000). Nitzan ------------------------- www.geocities.com/nitzanw www.scorchedearth3d.net -------------------------
Whoops, I fixed the following line
glTranslatef(0.0, 0.0, -1.0f*i);

to

glTranslatef(0.0, 0.0, -1.0f);

and now some of the triangles dont draw outside the viewing frustum. My new TPS are 312,000 for the triangles, 880,000 TPS for the display listed objects (geospheres).

If I only use 1 normal+color of the triangles I get 360,000 TPS.

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
Advertisement
You have to give display lists or vertex arrays.

As your data is changing, you''re right on the fact that the display lists may not be used.

If you have a *huge* database, you will not be able to use vertex arrays, unless you split your geometry. In that case, you would have to make sure that your vertex array pointers would change their states as rarely as possible.

The GL_TRAINGLE_STRIP technique gives identical results in this example, but can speed up up to 2x the performance for a great number of _JOINED_ triangles. In this example, there are only 2 joined traingles (eg 1 quad) displayed at each glBegin-glEnd. This is not representative.

This topic is closed to new replies.

Advertisement