[SDL] Perfomance problem with SDL+OpenGL

Alan Wolfe Atrix2 at cox.net
Sun Dec 3 02:42:23 PST 2006


Hi Phantom lord!

 

It sounds like vsync is the culprit.

 

When vsync is on, it only allows you to write to the screen when the monitor
is not refreshing itself which makes it so you don't get half of one frame
and half of the other at the same time.

 

60 and 80 hz are common refresh rates for monitors so it really does seem
like in the GL version of your code, vsync is on while on the other, vsync
is off.

 

Even though with vsync on it will only show a maximum of 80 fps, most of the
time between frames is spent waiting for the vsync so don't worry you can
ignore that it's 80 and move forward and not run into performance problems
any faster than you would in the non gl side. 

 

  _____  

From: sdl-bounces+atrix2=cox.net at libsdl.org
[mailto:sdl-bounces+atrix2=cox.net at libsdl.org] On Behalf Of Phantom Lord
Sent: Sunday, December 03, 2006 2:31 AM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: [SDL] Perfomance problem with SDL+OpenGL

 

Hi, I'm still developing the PhantomSDL library =P, but I stil have
perfomance problems =S...

AFAIK, iterators are most quick and best way to iterate a list (I don't get
very well with the STL...).

 

So, here is the code that gives me problems:

 

Instance Handler, Step Function:

std::list<PhantomSDL_CINSTANCE*>::iterator i;
    for(i = mInstances.begin(); i != mInstances.end(); i++)
        {
        if( (*i) == NULL)
            {
            mLog->write(2,"[CInstanceHandler]-> NULL pointer avoided."); 
            continue;
            }
        (*i)->stepEvent();
        if( (*i)->getVisible() ) (*i)->drawEvent();
        }

 

Every stance that can be "instanced" in the Instance Handler, inherits from
PhantomSDL_CINSTANCE.

So then, the drawing event of each instance may vary, but when rendering
nothing, i do get no more than ~400 fps (focused window, 800x600x32).

 

This is when rendering with SDL.

When rendering with OpenGL...in the same circumstances, i get no more than
~80 fps (focused window, 800x600x32).

 

Can somebody tell me if this is a problem of my code, or whatever.

 

BTW, I have a GeForce FX 5500 256 videocard.

 

Thx!

Cya

 



-- 
Phantom Lord
Caelis Studios --- <http://caelis-studio.com.ar> > Life's just a game

Caelis Studios Oficial <http://foro.caelis-studio.com.ar>  Forums

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061203/51ab877a/attachment.htm 


More information about the SDL mailing list