PDA

View Full Version : Same speed on every PC?



Hellhammer
05-31-2005, 01:22 PM
Hiho,
my first question here...

Why rotates a simple triangle on every PC with the same speed, when DrawScene() is built in a simple while(!done) construct without any FPS-delay thing (like necessary in SDL (http://www.libsdl.org/))?

You see, I am very new to OpenGL. :-D

Edit: My source code is the one of nehe.gamedev.net Lesson 5

Ehsan Kamrani
05-31-2005, 01:38 PM
No.They are rotated with different frame rates in different systems -- If i understand your question.
Read these discussions:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=2;t=018648
-Ehsan-

Hellhammer
05-31-2005, 02:14 PM
Thanks.

Now I use GetTickCount(); for checking time at the beginning of the while(!done) loop and the following for updating my scene:

glRotatef(rtri1,0.0f,1.5f,0.0f);
time_elapsed = time_now - time_prev;
rtri1 += 0.2f * (GLfloat) time_elapsed;

Before I used this method for updating my scene it
worked nicely, but now it runs slowly.

Ehsan Kamrani
05-31-2005, 02:32 PM
Awww.you can simply use from a greater value than 0.2. As an example you can use from the following code:
m_timeNow = GetTickCount(); // Hi-resolution clock
m_elapsedTime = m_timeNow - m_previousTime;
m_previousTime = m_timeNow;
angle += 2 * m_elapsedTime;//Greater value
if( angle >= 360.0f ) angle -= 360.0f;
glRotatef(angle, ...);

-Ehsan-

plasmonster
05-31-2005, 04:03 PM
GetTickCount() returns the elapsed system time in milliseconds, not seconds, so you need to scale accordingly.

Hellhammer
06-01-2005, 01:32 AM
Thanks, but I dont mean that kind of slow. ^^

I know, that I need to increase the value of rtri, but I mean it has a low FPS, it somehow stucks when I push a button (ie for rotating the triangle).

Maybe it is necessary to use hardware acceleration, but I dont know how I can do this.

Thanks for your patience.

Ehsan Kamrani
06-01-2005, 01:38 AM
Which graphics card are you using?

Hellhammer
06-01-2005, 06:22 AM
I use a GeForce 2 MX.

Ehsan Kamrani
06-01-2005, 06:40 AM
The NVIDIA GeForce2 MX provides optimized support for DirectX and OpenGL 1.2 applications under Microsoft® Windows® 98, Microsoft Windows NT® 4.0, Microsoft Windows 2000, and Microsoft Windows XP.
So it may doesn't support the new features of the current version of OpenGL.But i believe that you don't need to change it.
-Ehsan-