SDL and compiz fusion screen flickering

Hi,
I am trying to create a simple SDL application which simply calls the
following function once every second

glClearColor( 1.0, 1.0, 1.0, 1.0 );    glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapBuffers();

I am running this code on Ubuntu 8.04 with compiz fusion running @ Gnome.

The problem here is that I see a flickering window where white colour
appears for a short duration.

This problem disappears when I disable compiz fusion. How can this be solved
?

-Abhinav–
Yogi Berra - “A nickel ain’t worth a dime anymore.”

You probably have double-buffering enabled, and need to clear both
buffers (ie, clear one, swap buffers, then clear again).

SAOn July 16, 2008 2:44:34 pm Abhinav Lele wrote:

Hi,
I am trying to create a simple SDL application which simply calls the
following function once every second

glClearColor( 1.0, 1.0, 1.0, 1.0 );   

glClear(GL_COLOR_BUFFER_BIT); SDL_GL_SwapBuffers();

I am running this code on Ubuntu 8.04 with compiz fusion running @
Gnome.

The problem here is that I see a flickering window where white colour
appears for a short duration.

This problem disappears when I disable compiz fusion. How can this be
solved ?

thanks that worked … now i use something like this

SDL_GL_SwapBuffers(); glClearColor( 1.0, 1.0, 1.0, 1.0 );
glClear(GL_COLOR_BUFFER_BIT);

… do some drawing code …

SDL_GL_SwapBuffers();

I guess this should be okay if i am trying to show an animation.

-AbhinavOn Wed, Jul 16, 2008 at 10:50 PM, Stephen Anthony wrote:

On July 16, 2008 2:44:34 pm Abhinav Lele wrote:

Hi,
I am trying to create a simple SDL application which simply calls the
following function once every second

glClearColor( 1.0, 1.0, 1.0, 1.0 );

glClear(GL_COLOR_BUFFER_BIT); SDL_GL_SwapBuffers();

I am running this code on Ubuntu 8.04 with compiz fusion running @
Gnome.

The problem here is that I see a flickering window where white colour
appears for a short duration.

This problem disappears when I disable compiz fusion. How can this be
solved ?

You probably have double-buffering enabled, and need to clear both
buffers (ie, clear one, swap buffers, then clear again).

SA


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Henny Youngman - “I told the doctor I broke my leg in two places. He told
me to quit going to those places.”

or is this better

glClearColor( 1.0, 1.0, 1.0, 1.0 ); glClear(GL_COLOR_BUFFER_BIT);

… do some drawing code …

SDL_GL_SwapBuffers(); glClearColor( 1.0, 1.0, 1.0, 1.0 );
glClear(GL_COLOR_BUFFER_BIT);

But i was wondering as to why is my window being cleared by X11 when i am
not moving the window or doing anything with it. Is it because of compiz (
when I am rendering at a interval of 1 second) ?On Thu, Jul 17, 2008 at 12:24 AM, Abhinav Lele <@Abhinav_Lele> wrote:

thanks that worked … now i use something like this

SDL_GL_SwapBuffers(); glClearColor( 1.0, 1.0, 1.0, 1.0 );
glClear(GL_COLOR_BUFFER_BIT);

… do some drawing code …

SDL_GL_SwapBuffers();

I guess this should be okay if i am trying to show an animation.

-Abhinav

On Wed, Jul 16, 2008 at 10:50 PM, Stephen Anthony wrote:

On July 16, 2008 2:44:34 pm Abhinav Lele wrote:

Hi,
I am trying to create a simple SDL application which simply calls the
following function once every second

glClearColor( 1.0, 1.0, 1.0, 1.0 );

glClear(GL_COLOR_BUFFER_BIT); SDL_GL_SwapBuffers();

I am running this code on Ubuntu 8.04 with compiz fusion running @
Gnome.

The problem here is that I see a flickering window where white colour
appears for a short duration.

This problem disappears when I disable compiz fusion. How can this be
solved ?

You probably have double-buffering enabled, and need to clear both
buffers (ie, clear one, swap buffers, then clear again).

SA


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Henny Youngman - “I told the doctor I broke my leg in two places. He told
me to quit going to those places.”


Laurence J. Peter - “Originality is the fine art of remembering what you
hear but forgetting where you heard it.”

also now with the above code i still get a bit of flicker even when i render
at intervals of 10ms. The difference here is that I see a black band. I
believe this is because of me rendering irrespective of the monitor refresh
rate. If so how can I sync with it ?On Thu, Jul 17, 2008 at 12:31 AM, Abhinav Lele <@Abhinav_Lele> wrote:

or is this better

glClearColor( 1.0, 1.0, 1.0, 1.0 ); glClear(GL_COLOR_BUFFER_BIT);

… do some drawing code …

SDL_GL_SwapBuffers(); glClearColor( 1.0, 1.0, 1.0, 1.0 );
glClear(GL_COLOR_BUFFER_BIT);

But i was wondering as to why is my window being cleared by X11 when i am
not moving the window or doing anything with it. Is it because of compiz (
when I am rendering at a interval of 1 second) ?

On Thu, Jul 17, 2008 at 12:24 AM, Abhinav Lele <@Abhinav_Lele> wrote:

thanks that worked … now i use something like this

SDL_GL_SwapBuffers(); glClearColor( 1.0, 1.0, 1.0, 1.0 );
glClear(GL_COLOR_BUFFER_BIT);

… do some drawing code …

SDL_GL_SwapBuffers();

I guess this should be okay if i am trying to show an animation.

-Abhinav

On Wed, Jul 16, 2008 at 10:50 PM, Stephen Anthony wrote:

On July 16, 2008 2:44:34 pm Abhinav Lele wrote:

Hi,
I am trying to create a simple SDL application which simply calls the
following function once every second

glClearColor( 1.0, 1.0, 1.0, 1.0 );

glClear(GL_COLOR_BUFFER_BIT); SDL_GL_SwapBuffers();

I am running this code on Ubuntu 8.04 with compiz fusion running @
Gnome.

The problem here is that I see a flickering window where white colour
appears for a short duration.

This problem disappears when I disable compiz fusion. How can this be
solved ?

You probably have double-buffering enabled, and need to clear both
buffers (ie, clear one, swap buffers, then clear again).

SA


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Henny Youngman - “I told the doctor I broke my leg in two places. He told
me to quit going to those places.”


Laurence J. Peter - “Originality is the fine art of remembering what you
hear but forgetting where you heard it.”


Bill Cosby - “Advertising is the most fun you can have with your clothes
on.”

Look at the SDL_GL_SetAttribute command with ‘SDL_GL_SWAP_CONTROL’.
Note that this doesn’t work on all systems yet.

SAOn July 16, 2008 4:38:23 pm Abhinav Lele wrote:

also now with the above code i still get a bit of flicker even when i
render at intervals of 10ms. The difference here is that I see a
black band. I believe this is because of me rendering irrespective of
the monitor refresh rate. If so how can I sync with it ?