Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: why SwapBuffers doesn't work?

  1. #1
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    4

    why SwapBuffers doesn't work?

    Can anyone help me?

    The animations are flickering although I use SwapBuffers.
    ex: SwapBuffers(pDC->GetSafeHdc());
    I don't get the correct HDC or what?

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    586

    Re: why SwapBuffers doesn't work?

    Are you using double buffer? Are you calling SwapBuffers more than once per frame?

  3. #3
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    4

    Re: why SwapBuffers doesn't work?

    I "enabled" PFD_DOUBLEBUFFER and I use SwapBuffers every time after I create the current scene.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    586

    Re: why SwapBuffers doesn't work?

    Have you checked your code to make sure that SwapBuffers is only being called once. I accidentally had 2 calls one time time and others have also, which results in flickering. Also, check to see if you have vsync turned off. If so, turn vsync on and see how it looks. Maybe it is just tearing. Other than that, you would have to show some code, or give much more detail. Is the entire screen flickering? Parts of the screen? Just certain objects?

  5. #5
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    4

    Re: why SwapBuffers doesn't work?

    I call SwapBuffers only once per scene and the flickering affects all the rendered objects. About vsync don't know much, is part of glut? (I only use the VC's gl.h && MFC)
    Actually SwapBuffers does nothing in my case (if I take it out the result is exactly the same - flickering).

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    586

    Re: why SwapBuffers doesn't work?

    Is the flickering the exact same with or without the SwapBuffers? Without swapping the buffers, there shouldn't be any animation at all, because you would be rendering to the back buffer and the front buffer would just be blank. Did you check to verify that the PIXELFORMATDESCRIPTOR you requested is the same as what was set with SetPixelFormat? What values did you et PIXELFORMATDESCRIPTOR to?

  7. #7
    Senior Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    764

    Re: why SwapBuffers doesn't work?

    Could it be that you:

    glDrawBuffer( GL_FRONT )

    ???

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: why SwapBuffers doesn't work?

    It sounds like you are using MFC. Have you overloaded OnEraseBkgnd and made it return TRUE? If that's not done, Windows will erase the window itself to whatever color was used for the background brush. Returning TRUE tells MFC that you handle that yourself.

    Still doesn't explain why you get the same results with or w/o SwapBuffers. But it still might be something to check.
    Deiussum
    Software Engineer and OpenGL enthusiast

  9. #9
    Junior Member Newbie
    Join Date
    May 2003
    Location
    Coimbatore,TN,India
    Posts
    5

    Re: why SwapBuffers doesn't work?

    Probably the Window background color
    must be different from the OpenGL clear color. Set both to the same color and try

    balachandran
    balchandran

  10. #10
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    4

    Re: why SwapBuffers doesn't work?

    Thank you all for the advices !

    From what I've seen in my code:
    - I have glDrawBuffer(GL_FRONT_AND_BACK);
    - I am setting correctly the PIXELFORMATDESCRIPTOR;

    I still haven't tried to overload the gl function, but in the days to come shall do it.
    It is strange that the behaviour is the same with SwapBuffers or w/o, but at home I see no difference. Actually all my problems appear at work, where the scene flickers like hell. I heard something about some graphic cards making themselves some sort if prebuffering so it can be explained why it's all ok at home.

Page 1 of 2 12 LastLast

Similar Threads

  1. second UBO doesn't work
    By mlkn_mlkn in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-11-2015, 12:34 PM
  2. Opengl used to work but doesn't now
    By TJay2k2 in forum OpenGL: User Software
    Replies: 0
    Last Post: 02-22-2003, 02:17 PM
  3. It doesn't work...
    By GunCraP in forum OpenGL: User Software
    Replies: 0
    Last Post: 01-03-2003, 01:46 AM
  4. glutSolidSphere doesn't work with VB.
    By John Jenkins in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-08-2002, 08:54 AM
  5. Why doesn't this work
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-11-2002, 02:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean