PDA

View Full Version : GUI Programming Problems? :(


damn
09-28-2005, 01:44 PM
Hi!

Im busy making a 3D Engine to be used in a game, Its looking great considering i do things "trial and error" style and i try and use the internet to the fullest for its resources!

Im programming the engine using OpenGL and now Im adding support for GUI, basically(for now), loading bitmap files to the screen...

The problem is that the bitmaps flicker prefusely when drawn to the screen!
Can someone please give me some ideas on how to stop all the flickering?!?!?!

Mmmm... Im not sure what else to say?!?

:blush:

geon
09-28-2005, 03:40 PM
What kind of flickering? Could be many problems, like aliasing or no double buffering.

XORcist
09-29-2005, 03:52 AM
It could also be a Z-Fighting problem.

Are you rendering the bitmaps in Orthographic (Parallel) projection mode
(or)
Rendering the bitmaps as Screen aligned quads ?

If the depth buffer value of the polygon u used to render your GUI-window (or background ) & the depth of the polys for bitmaps are the same u can see this flicker. There are many ways to avoid z-fighting.

Hope it helps

Kenneth Gorking
09-29-2005, 09:12 AM
Maybe you forgot the "ValidateRect(0);" after you have drawn the bitmap.

NomadRock
09-29-2005, 12:54 PM
If you are drawing your bitmaps as textures on quads, and if they are flickering where they overlap, then your issue is with the z buffer, in this case you want to offset the quads. Say order them by depth, then start with the front ones and render them all, changing the z position slightly each time. Alternately, you can render them back to front, and disable depth testing while you render the GUI, however the first option is generally better because it will prevent some overdraw.

If this is not the case, maybe you ensure you have Vertical Sync turned on, so that it doesn't send half of your frame to the screen at a time. This makes sure that your frame wont be sent to the screen until after it is totally drawn, and it wont start drawing the next frame until after the first one has been totally sent.