[SDL] Speeding up glClear?

Stephane Marchesin stephane.marchesin at wanadoo.fr
Thu Jan 6 12:25:29 PST 2005

Steve Smith wrote:

>On Thu, 06 Jan 2005 15:52:39 -0300, Gabriel <mystml at adinet.com.uy> wrote:
>>What you can do though, if you don't need a lot of depth buffer
>>precission, is to use the range 0 - 0.5 in one frame, and then 0.5 - 1
>>in the next, then 0-0.5 and so on, thus removing the neccessity to
>>clear. I don't remember the specifics but there was a way to do that.
>I saw something like this just today, which involved switching the
>clearing mode itself from GL_LESS to GL_GREATER with each frame as
>well.  As I fail to grok why this would work for the moment, I'm going
>to try option 3 first.
>>>Third thought is to throw in a skybox of some kind, which will in
>>>theory remove the need to clear the color buffer with each frame.
>>This one is correct, and in fact, widely used. If you played Doom or
>>Duke Nukem 3D, and used one of the clip hacks, stepping out of the map
>>caused the background to become dirty. That's because the games assumed
>>the map was closed, and therefore didn't clear the color buffer at all.
>I distinctly recall liberally using IDCLIP, heh.  Excellent, this will
>be where I start then - thanks much!  I'm very curious to know,
>though, why mapping a texture across the entire screen would be so
>much faster than setting a single color value across it all.  Any
>insights to offer?
250ms for a glClear is _really_ slow. It's even slower than software 
rendering. What's your video hardware/opengl drivers ?


More information about the SDL mailing list