Results 1 to 6 of 6

Thread: why this is happening?

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    Poland
    Posts
    10

    why this is happening?

    Hello

    I'm new in OpenGL, but I have written very simple app in window or fullscreen mode, where I'm moving (using glTranslatef) a box (GL_QUADS) on the scene. But it flickers a lot!!!. I have Duble Buffering enabled. I also run another thread - server thread, but when I run it, the animation slows down a lot (like 10fps).
    What is the best way to do smooth animation? (fixed framerate) Any examples of code? And what am I doing wrong?

    Regards

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: why this is happening?

    Do you want to post your code

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    Poland
    Posts
    10

    Re: why this is happening?

    I'm not able to do it right now.

    But anyway, I used NeHe code for setting the OpenGL window, then I use also his code for writing the scene. In WinMain I use the while() loop and call DrawGLScene() function and then swap buffers.
    Strange thing is, that when I'm animating only a triangle, it looks smooth, but where it goes to quads, the flickers occurs
    It looks like the SwapBuffer() function is swaping to fast?!?
    And also, how can I reduce the CPU load, because it's almost 100% now !.

    Regards

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Sep 2000
    Location
    SWEDEN
    Posts
    601

    Re: why this is happening?

    It would be good if you could post a screenshot or describe the flickering more in detail. Here are some possible reasons for it:

    * Vertical sync is disabled in your desktop properties which means that Swapbuffers won't wait for vertical sync. This lead to tearing were you see part of the old frame as the current frame is being rendered. Turn vsync back on to solve this.

    * Z-buffer precision issues. Often looks like horizontal flickering lines on polygons that overlap. To solve this, push your near plane out.

    * You are in fact not double buffering for some reason. Check what kind of pixelformat you get (if running under windows).

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    Poland
    Posts
    10

    Re: why this is happening?

    Thanx for reply!

    Originally posted by harsman:
    It would be good if you could post a screenshot or describe the flickering more in detail. Here are some possible reasons for it:

    * Vertical sync is disabled in your desktop properties which means that Swapbuffers won't wait for vertical sync. This lead to tearing were you see part of the old frame as the current frame is being rendered. Turn vsync back on to solve this.
    OK. This looks like the effect you've described above - I see part of old frame during new one (I think I see). Maybe this is the problem, but how to solve it from code (to be sure that on other PC this will also work OK).?? How to force the SwapBuffer() to wait for VSYNC?

    Can someone also post the code for making the frame rate fixed? Something with multimedia timer, or...?

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Sep 2000
    Location
    SWEDEN
    Posts
    601

    Re: why this is happening?

    If you're running windows you can edit the default Vsync behaviour in your graphics drivers panel in the desktop properties. If you want to change it from within your program, use the WGL_EXT_swap_control extension. There are tutorials on using extensions at this site. For the timing issue I suggest you use google or look at the Nehe tutorials here .

Similar Threads

  1. Trying to get compute shader happening
    By PeterGali in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-23-2015, 10:55 PM
  2. What's happening to my triangles?
    By mynameisjohn in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-18-2015, 06:23 AM
  3. Replies: 1
    Last Post: 08-27-2009, 05:31 PM
  4. What is happening?
    By Zak McKrakem in forum OpenGL: Advanced Coding
    Replies: 61
    Last Post: 03-31-2005, 12:31 PM
  5. What's happening with opengl
    By Toni in forum OpenGL: General
    Replies: 12
    Last Post: 06-17-2003, 06:36 PM

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