Forums > Dev

Fullscreen OpenGL tearing

August 17, 2006 | 6:12 pm

We are developing a graphical Max external that utilizes OpenGL on a Mac under AGL. We are calling OpenGL in a Qelem. When we use OpenGL in a fullscreen context on a CRT we experience flicker and tearing. This does not occur when we use OpenGL within a window.

We have tried using the form of double buffering recommended by Apple, but this presents a new set of problems, as (desired) traces left by our graphical objects do not appear in both buffers and thus appear in only half of our frames.

Does anyone have any advice on synchronizing our OpenGL calls with the display raster retrace?


August 17, 2006 | 9:51 pm

On Aug 17, 2006, at 11:12 AM, Fred Collopy wrote:

>
> We are developing a graphical Max external that utilizes OpenGL on
> a Mac under AGL. We are calling OpenGL in a Qelem. When we use
> OpenGL in a fullscreen context on a CRT we experience flicker and
> tearing. This does not occur when we use OpenGL within a window.
>
> We have tried using the form of double buffering recommended by
> Apple, but this presents a new set of problems, as (desired) traces
> left by our graphical objects do not appear in both buffers and
> thus appear in only half of our frames.
>
> Does anyone have any advice on synchronizing our OpenGL calls with
> the display raster retrace?

We use aglSetInteger() with parameter AGL_SWAP_INTERVAL, and a value
of 1. Not sure if there are differences with using fullscreen
contexts, however, we don’t actually use fullscreen contexts, but
rather windowed contexts without a window border.

You will definitely need to use double buffering however. I’m not
sure what you’re doing to have problems with double buffering, unless
you are swapping twice.

-Joshua


August 22, 2006 | 2:46 am

Sounds frustrating….

Here are a few simple suggestions:

1) enable VSync or Vertical Sync on the graphics driver. I am not sure how to do this on a mac, but that syncronizes the double buffer swap with the vertical refresh.
2) since vsync needs double buffering to work, you must figure out how to get around the double buffering problems.
3) Are you reading from the screen buffer? There is a way of explicitly setting open gl to read from the front or back buffer.
4) Are you clearing the screen/depth/alpha at the begining of the program and not every frame? If so, you will have to clear screen/depth/alpha once for each buffer at the beinging of the program.

psudocode:

init()
{
clear(RGBA|DEPTH)
swapbuffers()
clear(RGBA|DEPTH)
swapbuffers()
}

5)


August 22, 2006 | 3:47 am

Joshua,

Thanks. We switched to using windowed context and that solved it. Interestingly, we are not using AGL_DOUBLEBUFFER param, but it works fine even on CRT displays.

Fred


Viewing 4 posts - 1 through 4 (of 4 total)