Link to home
Start Free TrialLog in
Avatar of skalmari
skalmari

asked on

Animation Flicker

I am working on an  MFC Program where i have to display a semi transparent window
with buttons On the top of an OPENGL animation.
So i have coded two different applications one to create a transparent window and the
other a OPENGL animation.These applications runs fine with out any flicker when run
separetely.

But when i overlay the semi transparent window on the top of  openGL Animation window,
The semi transparent window begins to flicker badly. How can i avoid this?
I have tried various methods but with out much success.Can any one Help on this
thanks
ASKER CERTIFIED SOLUTION
Avatar of davebytes
davebytes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skalmari
skalmari

ASKER

Well i need to have two different applications and cannot render the
buttons into a texture.
Because my transparent window is a VB application hosting  a IE Browser control which contains a web page with a green background and some buttons associated with java script events. I am making use of win32 Api call SetWindowLong and SetLayeredWindowAttributes to key out the green background color and making it  transparent and thereby just exposing the buttons on the top of my VC++- OPENGL water effect Animation.So the web buttons on transparent window  cannot be rendered into a texture. Any other suggestions please!
Hmmm... try setting vsync on the OpenGL context.  That may or may not alleviate things.  Once you're in a windowed environment, the windowing system controls things a lot more.

-d
well the vsync needs to have support from extensions available on the graphic card
which i don't have it.So i have come up with my own solution for this problem.
I have resolved this problem making parts of the window transparent using Regions with Win32.The code guru has some nice articles on it
describing the technique of making shaped windows and achieving transparency using bitmap regions.But i have found this technique rather slow when compared to the windows layering technique as it has to perform perpixel operations to find out the transparent regions on the bitmap.So is there any other way to achieve transparency other than layering and region?
VSYNC is available on nearly all modern graphic cards, that is anything in the last say 3-4 years.  What card do you have, what OS?  Are you running latest drivers?

-d
Well i am running WIndows XP which is having an  integrated video card
INTEL 82865G Graphics Controller
i865 chipset should certainly give you the ability to vsync under OpenGL or DirectX.  Under GL, I don't think you can really query it.  Under DirectX, I believe it is a CAPS flag somewhere, like on the D3D device object.

-d
Maybe you should enable "double buffering". This often is the reason for flickering.
Hello Mr.Dave
Well Double buffering is enabled in my program.
I am setting up my PIXELFORMATDESCRIPTOR as follows to enable
Double buffering and calling SwapBuffers(wglGetCurrentDC());
in my "OnDraw" function to swap my primary and back buffer.
I have increased the point values,as it seems to be a tough
question to answer.
thanks

static PIXELFORMATDESCRIPTOR pfd =
      {
            sizeof(PIXELFORMATDESCRIPTOR),  // size of this pfd
            1,                              // version number
            PFD_DRAW_TO_WINDOW |            // support window
              PFD_SUPPORT_OPENGL |          // support OpenGL
              PFD_DOUBLEBUFFER,             // double buffered
            PFD_TYPE_RGBA,                  // RGBA type
            24,                             // 24-bit color depth
            0, 0, 0, 0, 0, 0,               // color bits ignored
            0,                              // no alpha buffer
            0,                              // shift bit ignored
            0,                              // no accumulation buffer
            0, 0, 0, 0,                     // accum bits ignored
            32,                             // 32-bit z-buffer
            0,                              // no stencil buffer
            0,                              // no auxiliary buffer
            PFD_MAIN_PLANE,                 // main layer
            0,                              // reserved
            0, 0, 0                         // layer masks ignored
      };
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial