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

Thread: Movement lagging

  1. #1
    Member Contributor
    Join Date
    Jul 2008
    Posts
    52

    Movement lagging

    Dear guys, I'm experiencing problems with animation and refresh rate.

    The problems are:

    1. The faster I move, less smoother is the movement. I cannot find a way to move faster in a scene without translating "the camera" more points in the system. If I do my camera to move a large amount of points (1.0 i.e.) in a time, the movement seems to be lagging. A way I found to do the movement smoother, is to make the camera move a little bit each frame (like 0.05 points in Z axis, for example), but this cause the speed of movement too slow and the camera delays a lot to reach a certain point in the space.

    My question: what is the way to increase the speed of movement and at same time have a smooth movement, whether this is possible or not?

    2. The faster I move the camera, more flickering is the lines, for example. I tried to reproduce the effect in the image below, but actually the effect is even worse.



    My question: Why this occurs? Is there a way to prevent this?

    Thank you all!
    Regards!

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Movement lagging

    enable vsync.
    wglSwapInterval(1);

  3. #3
    Member Contributor
    Join Date
    Jul 2008
    Posts
    52

    Re: Movement lagging

    ZbuffeR, I couldn't find this function. Is it from a specific library? I'm using GLUT. Is there a enable vsync function via GLUT?

    []s

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Movement lagging

    that function is an extension that only works on windows, you need to find the call entry point of this function at runtime, for more informations about extensions look here

    I don't know an equivalent on linux or other operating system to force vertical synchronization... you can enable it in your cg configuration interface I think.

  5. #5
    Senior Member Regular Contributor CatDog's Avatar
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    226

    Re: Movement lagging

    First of all, to see if it solves the problem, I would disable vertical sync in the display driver settings.

    The effect is called "tearing" by the way. Try this with your favourite web search engine.

    CatDog

  6. #6
    Member Contributor
    Join Date
    Jul 2008
    Posts
    52

    Re: Movement lagging

    I enabled V-sync in driver and the problem solved. Now I only need to enable v-sync on application, but I'm struggling to find the properly function, I'm using Microsoft Visual Studio 2008 (C++) and looks like MS headers doesn't bring the wglSwapInterval function. I tried to prototype it from Windows API but it doesn't work. But I will try more later.

    Now I'm more worried with the 1st problem I've described, anyone could help me with it?

    []s

  7. #7
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Movement lagging

    copied from mplayerhq.hu source code :


    int (*SwapInterval)(int);


    ...
    SwapInterval = getProcAddress("glXSwapInterval");
    if (!SwapInterval)
    SwapInterval = getProcAddress("glXSwapIntervalEXT");
    if (!SwapInterval)
    SwapInterval = getProcAddress("glXSwapIntervalSGI");
    if (!SwapInterval)
    SwapInterval = getProcAddress("wglSwapInterval");
    if (!SwapInterval)
    SwapInterval = getProcAddress("wglSwapIntervalEXT");
    if (!SwapInterval)
    SwapInterval = getProcAddress("wglSwapIntervalSGI");


    ...
    SwapInterval(1);



    About you point 1, I though it had the same cause.
    How is done your input handling ? Keyboard, mouse ?
    Naive glut keyboard handling would only get you the keyboard repetition, something like 10 updates per second. The library GLFW is better suited to what you are doing by the way. Very easy and nice (plus it has vsync control built in).

    Another problem comes from what you are drawing : low poly wireframe will always appear to "jump" even with 100fps. Try with filled polygons, to compare : if it is better, then a solution for wireframe would be to do some motion blur.
    It can be done in different ways, depending you needs, the scene complexity, etc.

  8. #8
    Member Contributor
    Join Date
    Jul 2008
    Posts
    52

    Re: Movement lagging

    Quote Originally Posted by ZbuffeR
    copied from mplayerhq.hu source code :


    int (*SwapInterval)(int);


    ...
    SwapInterval = getProcAddress("glXSwapInterval");
    if (!SwapInterval)
    SwapInterval = getProcAddress("glXSwapIntervalEXT");
    if (!SwapInterval)
    SwapInterval = getProcAddress("glXSwapIntervalSGI");
    if (!SwapInterval)
    SwapInterval = getProcAddress("wglSwapInterval");
    if (!SwapInterval)
    SwapInterval = getProcAddress("wglSwapIntervalEXT");
    if (!SwapInterval)
    SwapInterval = getProcAddress("wglSwapIntervalSGI");


    ...
    SwapInterval(1);



    About you point 1, I though it had the same cause.
    How is done your input handling ? Keyboard, mouse ?
    Naive glut keyboard handling would only get you the keyboard repetition, something like 10 updates per second. The library GLFW is better suited to what you are doing by the way. Very easy and nice (plus it has vsync control built in).

    Another problem comes from what you are drawing : low poly wireframe will always appear to "jump" even with 100fps. Try with filled polygons, to compare : if it is better, then a solution for wireframe would be to do some motion blur.
    It can be done in different ways, depending you needs, the scene complexity, etc.
    thanks Zbuffer, my input is being done via mouse and keyboard. By now, I can't use GLFW, it's a GLUT research. I filled the polygon and made some simple lightining, the motion flow appeared to be slightly better, but in general it persists lagging. I thought the cause is my LCD monitor, but it is very fast for games (2ms real), I don't have this problem for any games, not even with Trackmania that is a fast motion game.

    I think this is normal and it must have a way to be softened, but like you said, maybe not with glut.

    Another simple question, I'm thinking that GL header that comes with Visual C++ 2008 is Opengl 1.1 compliant. Is there a way to check the version? If it is 1.1, how could I get at least 2.0 version? I want to make use at least of Shader Model 2.0, and with 1.1 that will be impossible.

    []s

  9. #9
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Movement lagging

    http://www.opengl.org/wiki/index.php...and_extensions

    Use GLEE or GLEW it will be simpler.

  10. #10
    Member Contributor
    Join Date
    Jul 2008
    Posts
    52

    Re: Movement lagging

    Thank you again ZbuffeR, I really appreciate your patience for helping me. When I grow up I want to be like you!

    Regards!

Page 1 of 2 12 LastLast

Similar Threads

  1. Problem with lagging animation over time
    By Triffid in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 06-28-2013, 07:04 AM
  2. Lagging problem
    By PowersWithin in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 05-28-2009, 10:02 AM
  3. Games are lagging ?
    By in forum OpenGL: User Software
    Replies: 4
    Last Post: 01-26-2004, 01:22 PM
  4. Lagging
    By whatabronze in forum OpenGL: User Software
    Replies: 1
    Last Post: 07-04-2003, 04:25 AM
  5. OpenGL Lagging games on new OS
    By BrookieDragon in forum OpenGL: User Software
    Replies: 1
    Last Post: 04-16-2002, 06:21 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