glLoadIdentity() slows down the fps??
Imagine simple scene with two cubes rotating.
Now I do glLoadIdentity() to have different rotations for every cube. Now my fps brakes down. Without any glLoadIdentity() I get about 1111 fps and with three glLoadIdentity()''s I just get 650 fps....
why the hell it this slowing down my system like this?
How can I write a faster glLoadIdentity()?? May I just have to reset the modelview matrix to zero?
thx
Dark
DarkMcNugget next time... ;)
glLoadIdentity() sould be very fast. you could doing it yourself with the following:
- Jono AH
float ident[16]={1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};LoadTransposeMatrixf(ident);
- Jono AH
- JonoRule #1: If you build it, they will come -- to hack and cheat.
Another nice joke:
Because I got frustrated I tried somethings out and fount out the following:
If you do
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
every frame and your scene is very simple, try to leave it out and check the framerate again. With my two cube I got about 8150 fps :D instead of 500.....
Maybe I found the season why unreal, halflife and all quake-games have something we call void... They just dont clear the buffer to get fps...
Maybe I should drink some whiskey to get that :D
ps. Thanks a lott for the matrics-code!
Because I got frustrated I tried somethings out and fount out the following:
If you do
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
every frame and your scene is very simple, try to leave it out and check the framerate again. With my two cube I got about 8150 fps :D instead of 500.....
Maybe I found the season why unreal, halflife and all quake-games have something we call void... They just dont clear the buffer to get fps...
Maybe I should drink some whiskey to get that :D
ps. Thanks a lott for the matrics-code!
DarkMcNugget next time... ;)
ok, to summary this a little bit:
When I use no LoadIdentity to render the scene and no bufferclear with two cubes renderd I get 8700 fps.
When I use clearbuffer I get 1177
When I use LoadIdentity two times without clearbuffer: 1675
When I use ClearBuffer and two times LoadIdentity: 648
BTW: LoadIdentity is as fast as the manuel way...
But the speed goes down too fast... But everyone seems to need LoadIdentity.... ok, ClearBuffer is not really needed.
Can someone explain this mystery?
When I use no LoadIdentity to render the scene and no bufferclear with two cubes renderd I get 8700 fps.
When I use clearbuffer I get 1177
When I use LoadIdentity two times without clearbuffer: 1675
When I use ClearBuffer and two times LoadIdentity: 648
BTW: LoadIdentity is as fast as the manuel way...
But the speed goes down too fast... But everyone seems to need LoadIdentity.... ok, ClearBuffer is not really needed.
Can someone explain this mystery?
DarkMcNugget next time... ;)
So it takes up a little time. Does that matter? From 1111fps to 650fps is a big difference, but both are incredibly fast. Nothing like what you''ll get in an actual program. There, the time taken by glLoadIdentity won''t halve the framerate. When your scene is as simple as this, pretty much anything you do will cause a big drop in framerate. Adding 0.6ms per frame rendered might cause a drop from 1111fps to 650fps (over 40% drop), but if you were at 60fps, you get 58fps (a 3.7% drop).

Kippesoep
*sigh*
See, a 3D card is designed to actually render full 3D environments, with a few thousand up to a few million faces. If you only two cubes , or 24 faces, then pretty much any performance timing is going to be 100% bogus. The rendering is going to be so extremely fast, that adding anything into the code (glLoadIdentity(), printf(), insert_your_favorite_function_here()) is going to drop the ridiculously high framerate of a few thousand fps. Loading a matrix will take longer than transfering the render commands for 24 faces to the 3D card.
Besides that, those 24 render calls are going to be fully cached in the command FIFO of the GPU. In other words: you are not even measuring the rendertime, as it will be done in parallel to the CPU, unless you throw a glFlush() or a buffer swap in, before taking the time measure.
So, to get actually meaningful performance tests, use a real scene. A quake level for example. And be sure to use a high performance counter for the measuring (RDTSC, or QueryPerformanceCounter()).
Edit: Kippesoep beat me to it
[edited by - Yann L on January 4, 2003 8:06:03 AM]
See, a 3D card is designed to actually render full 3D environments, with a few thousand up to a few million faces. If you only two cubes , or 24 faces, then pretty much any performance timing is going to be 100% bogus. The rendering is going to be so extremely fast, that adding anything into the code (glLoadIdentity(), printf(), insert_your_favorite_function_here()) is going to drop the ridiculously high framerate of a few thousand fps. Loading a matrix will take longer than transfering the render commands for 24 faces to the 3D card.
Besides that, those 24 render calls are going to be fully cached in the command FIFO of the GPU. In other words: you are not even measuring the rendertime, as it will be done in parallel to the CPU, unless you throw a glFlush() or a buffer swap in, before taking the time measure.
So, to get actually meaningful performance tests, use a real scene. A quake level for example. And be sure to use a high performance counter for the measuring (RDTSC, or QueryPerformanceCounter()).
Edit: Kippesoep beat me to it

[edited by - Yann L on January 4, 2003 8:06:03 AM]
ok, understood. I did some calculation and figured out some interesting results. A physical framerate of 10000 is not realistic but my counter works fine...
Well, forget about it. It works and we will see what happens with bigger scenes which are more complex.
Talk to you later!
Thanks a lott!
Dark
Well, forget about it. It works and we will see what happens with bigger scenes which are more complex.
Talk to you later!
Thanks a lott!
Dark
DarkMcNugget next time... ;)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement