WindowServer Causing Implicit Refresh?

Apprentice
Posts: 17
Joined: 2005.05
Post: #1
This is really bugging me... Im developing an OpenGL bassed 3D game, and have noticed some strange refresh issues when i drag a window/show a menu/show the dock inside the bounds of the OpenGL context. It looks as if the backbuffer is being forced to be drawn even though I haven't swapped the buffer...

At first i thought is was just my app, but I fooled around in another OGL based game, Halo, and was surprised that it too had the same problem. For those of you who own the game, does showing the volume/brightness control bezels cause a refresh issue? Also, try showing/hiding the dock above the game window (this is trcky, but can be done). Does this cause an issue?

I've tried to take a screenshot but the flicker is too fast for my fingers... I'll install SnapzPro and see if its captures show the problem.

I'm just wondering... I'm using glDrawArrays to render my vertices. The following code causes this same flicker to appear even if i dont move/show a window above the context...

Code:
' draw node
glColor3f( .6, .6, .6 )
glDrawArrays( GL_TRIANGLES, node.long(20), node.long(24) )

' draw wireframe
glColor3f( 1, 1, 1 )
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE )
glDrawArrays( GL_TRIANGLES, node.long(20), node.long(24) )
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL )

But, if i remove the "draw wireframe" section it works fine, and only flickers when you move a window above the OGL context.

Also the flickering doesn't seem to be constant. It looks as if it occurs at different stages of the rendering process, as different parts of my geometry seem to flicker, not just one part of it.

Any help, reasons, etc, would be greatly appreciated. Is it related to the refresh rate? or am i forgetting to do something? or is it something i just have to live with?

Machine Stats:
- iBook G4 1.07gHz
- 768MB RAM
- Radeon Mobility 9200
- OS X 10.3.5

i also tried it on my dads machine. his is a:
- iBook G3 800mHZ
- 512MB RAM
- Radeon Mobility 7500 (AFAIK)
- OS X 10.3.4 (so its not just 10.3.5!)

Thanks,
Matrix
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
I've seen the window server swap the buffers without me telling it to before, but usually only if I switch to another application, or another window comes up on top of my OpenGL window. As long as you're not drawing things to the back buffer that you don't want showing up on the screen, it shouldn't be too noticeable, but maybe I'm wrong... It sounds like you're saying it's getting swapped in the middle of rendering.

If this is a fullscreen game, perhaps turning on VBL sync would help?

Alex Diener
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #3
I can always see this happen when I zoom in with Universal Access-- scrolling around causes the partially-rendered back buffer to show up.

You can also see it in Apple's Vertex Optimization sample code when you use one of the two Vertex Array Range settings and drag the window around. It doesn't happen when you use the other settings (either regular Vertex Arrays, or entirely on the GPU with a vertex program.)

I'm not sure (because the behavior might depend on your video card) but this implies that it is a shared data access problem: the window server is jumping in to redraw the scene at some arbitrary point in your rendering cycle. If you use regular VAs, the GL keeps a copy of your data, so the window server uses that copy (the previous frame's clean data) to redraw. On the other hand if you use VAR, then your app owns the only copy, and you're halfway through updating it when the window server uses it to redraw, so the results are garbled.

This is similar to the texture corruption problems visible in Airburst Extreme and other games that map textures into AGP.
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2005.05
Post: #4
So is there any known way to fix this? Its really p***ing me off...

I'll make the game eventually go full-screen (ATM, i have it windowed for debugging purposes) but I'll probably leave the option in for it to run in a window (so people can chat/read email/ect while its running). But I'd prefer if I could have it do this without it getting corrupted by the windowserver all the time...

Thanks,
Matrix
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
I thought this was only an issue with single-buffered contexts?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Tricks with dialog boxes in fullscreen mode causing permanent framerate drops. Sea Manky 2 3,012 Aug 7, 2007 06:20 AM
Last Post: Sea Manky
  Low-level control of refresh rate nfunit 4 3,451 Dec 7, 2006 07:34 PM
Last Post: OneSadCookie
  SDL causing linking errors. unknown 1 2,265 Feb 26, 2006 10:12 AM
Last Post: unknown
  Unused variables causing program not to work SonOfALink 3 2,230 Jan 3, 2006 12:26 PM
Last Post: zKing
  Nearly overlapping Quads causing Jagged Edges Lunatic 3 3,808 Oct 28, 2005 04:41 AM
Last Post: Lunatic