Repainting

Hi !

I have an SDL application that is not very interactive so I don’t need to
redraw the window all the time, I don’t need a fixed framerate, I only need
to redraw it when things change, I have a dirty flag that is checked in the
event loop and then the window is updated.

The problem is when the window is covered by another window and then
uncovered again, this cause a “repaint” message to be sent by the OS, is
there any way to detect this ?

At the moment I have set a timer that forces an update every 500ms, but I
also have other threads running so I would prefer to only update the OpenGL
output when needed to as this can be pretty time consuming.

Mikael

Hi !

I have an SDL application that is not very interactive so I don’t need to
redraw the window all the time, I don’t need a fixed framerate, I only need
to redraw it when things change, I have a dirty flag that is checked in the
event loop and then the window is updated.

The problem is when the window is covered by another window and then
uncovered again, this cause a “repaint” message to be sent by the OS, is
there any way to detect this ?

At the moment I have set a timer that forces an update every 500ms, but I
also have other threads running so I would prefer to only update the OpenGL
output when needed to as this can be pretty time consuming.

If you’re using SDL in an X11 environment, you don’t need to handle
repainting when using SDL for 2D. If you’re using SDL for 3D via
OpenGL, then you can enable the SDL_VIDEOEXPOSE event which will
arrive when the screen has been exposed and needs to be redrawn.

Use:
SDL_EventState(SDL_VIDEOEXPOSE, SDL_ENABLE);

See ya!
-Sam Lantinga, Lead Programmer, Loki Software, Inc.

Hi !

Does this work on Windows to ?

I put an SDL_EventState( SDL_VIDEOEXPOSE, SDL_ENABLE); at the start of my
app, but I don’t receive any SDL_VIDEOEXPOSE events…

Do I need to put the SDL_EventState in any special place in the code (before
or after SDL_Init for example) ?

Is there anything else that needs to be enabled ?

Mikael> ----- Original Message -----

From: slouken@devolution.com (Sam Lantinga)
To:
Sent: Sunday, June 24, 2001 5:20 PM
Subject: Re: [SDL] Repainting…

Hi !

I have an SDL application that is not very interactive so I don’t need
to

redraw the window all the time, I don’t need a fixed framerate, I only
need

to redraw it when things change, I have a dirty flag that is checked in
the

event loop and then the window is updated.

The problem is when the window is covered by another window and then
uncovered again, this cause a “repaint” message to be sent by the OS, is
there any way to detect this ?

At the moment I have set a timer that forces an update every 500ms, but
I

also have other threads running so I would prefer to only update the
OpenGL

output when needed to as this can be pretty time consuming.

If you’re using SDL in an X11 environment, you don’t need to handle
repainting when using SDL for 2D. If you’re using SDL for 3D via
OpenGL, then you can enable the SDL_VIDEOEXPOSE event which will
arrive when the screen has been exposed and needs to be redrawn.

Use:
SDL_EventState(SDL_VIDEOEXPOSE, SDL_ENABLE);

See ya!
-Sam Lantinga, Lead Programmer, Loki Software, Inc.

Hi !

Does this work on Windows to ?

I put an SDL_EventState( SDL_VIDEOEXPOSE, SDL_ENABLE); at the start of my
app, but I don’t receive any SDL_VIDEOEXPOSE events…

Do I need to put the SDL_EventState in any special place in the code (before
or after SDL_Init for example) ?

Is there anything else that needs to be enabled ?

No, it’s not implemented on Windows. Any volunteers?

See ya,
-Sam Lantinga, Lead Programmer, Loki Software, Inc.