PDA

View Full Version : Performance increasing



yaro_dup1
07-15-2003, 08:52 AM
Hi,

I was experimenting with that code:



void render()
{
glBegin( GL_QUADS );
for( float i = 0; i < 100; i += 0.1f )
{
glVertex3f( 0, 1, i );
glVertex3f( 0, 0, i );
glVertex3f( 1, 0, i );
glVertex3f( 1, 1, i );
}
glEnd();
}


First I called render() for every frame, next I've compiled this function into display list, and later I used LockArraysEXT (with created array of vertices with that coordinates). In all three cases I've got the same number of FPS. Is it normal?

I've checked this codes on AMD K6-2 500 MHz and AMD Athlon XP 2000+. There was the same result: 42 FPS. I've tested it on the same GPU GeForce2 GTS and I think that no matter what CPU I've got because I'm calling only OpenGL commands which contains GPU? Am I right? But could someone give me an example of using display lists or EXT_compiled_array that speeds up the rendering?

thanks
yaro

[This message has been edited by glYaro (edited 07-15-2003).]

Relic
07-15-2003, 10:36 AM
Check if you have disabled wait on vertical blank (vsync) in the OpenGL of the display control panel.
What are the sizes of these quads? Does it get faster if you're reducing the window's size? (fill rate bound)

Some guy
07-15-2003, 04:22 PM
Compiled vertex arrays, CVA, is not important and if you use vertex buffers objects, VBO, do they give you the same benefits and also a lot of other advantages. Take a look at this CVA demo with a babe too see the point. http://opengl.nutty.org/extensions/index.html

The important difference is if the graphics hardware can get the vertices without any help. This will become more and more important since GPUs is getting higher performance faster than CPUs. Most real programs can not afford to waste CPU cycles on something like this.

In your program does display lists have the above mentioned advantage. This should give a lot more time for the CPU to do other stuff.

I am also at the same line as Relic concerning the equal fps.

errno
07-15-2003, 10:28 PM
only 42 fps ... with this little rendering function ... it sound like a vertical sync problem.

kehziah
07-15-2003, 11:00 PM
How is the Render method called? Do you use a (Win32) timer?

yaro_dup1
07-16-2003, 12:30 AM
There should be i += 0.01f in code above (yeah, I know it is a very big difference).
But is it a way to speed that simple code (of 10000 quads) up?
I render the scene in loop, I don't use any timer.
I will look at CVA demo, thanks for link.
But disabling/enabling vsync changes nothing because my monitor refresh frequency is 85 Hz. If I change the window size (I was testing it with glViewport) my prog speeds up so the speed depends on fill rate. Now I'm sure that all of this is processed only by GPU (dontcare about CPU working on for loop). Thanks for help.

Is disabling vsync safe for monitor?

thanks in advance


[This message has been edited by glYaro (edited 07-16-2003).]

Relic
07-16-2003, 11:20 AM
Disabling "wait for vertical blank" does not change how the monitor operates. It just means that a SwapBuffers() call is executed _immediately_ when processed.
With wait for vertical blank" it waits until the monitor has fully refreshed its last image and swaps then, so that you never see parts of different images of an animation on the screen. This prohibits disturbing tearing effects, but limits the framrates to full denominators of your monitor refresh (e.g. 60, 30, 20, 15, 12, 10,... frames per second).

yaro_dup1
07-16-2003, 12:54 PM
Thanks.