PDA

View Full Version : Movement lagging



gui24a
08-02-2008, 04:41 PM
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.

http://img58.imageshack.us/img58/2527/sampleed3.jpg

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

Thank you all!
Regards!

ZbuffeR
08-02-2008, 05:09 PM
enable vsync.
wglSwapInterval(1);

gui24a
08-02-2008, 05:28 PM
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

dletozeun
08-03-2008, 03:55 AM
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 (http://www.opengl.org/resources/features/OGLextensions/)

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.

CatDog
08-03-2008, 05:37 AM
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

gui24a
08-03-2008, 07:25 AM
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

ZbuffeR
08-03-2008, 09:22 AM
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.

gui24a
08-03-2008, 10:18 AM
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

ZbuffeR
08-03-2008, 10:35 AM
http://www.opengl.org/wiki/index.php/Getting_started#OpenGL_2.0_and_extensions

Use GLEE or GLEW it will be simpler.

gui24a
08-03-2008, 10:49 AM
Thank you again ZbuffeR, I really appreciate your patience for helping me. When I grow up I want to be like you! :D

Regards!

dletozeun
08-03-2008, 10:59 AM
No you can't...there is only one place for a z-buffer.

ZbuffeR
08-03-2008, 11:00 AM
lol, thanks anyway !

gui24a
08-03-2008, 11:13 AM
No you can't...there is only one place for a z-buffer.

:D

My dream is to master OpenGL or Direct3D, but even doing this, it will be impossible to create a game like Crysis (lol) by working alone, unless I had 2 or 3 lifes, lol. I love 3D graphics, I spent hours studying GPU architectures but now it's time to learn some programming skills. I'm doing my conclusion work for university so I can finally get my diploma in computing science, but I want to continue this work and try to create some cool stuff.

I want to be like you in a mean of mastering Opengl, but if I become a graphics part, I prefer to be a stream processor, lol.

[]s

dletozeun
08-03-2008, 11:21 AM
if I become a graphics part, I prefer to be a stream processor


What a geek! :D

I'd rather be... a cat. :)