annoying vibrating line!

Started by
3 comments, last by robert_s 22 years, 5 months ago
Hi all!! Here I have a bit funny problem in my flight sim engine and I don''t know if I can explain properly!! Imagine you see in front of you a horizontal line across the window you looking at. say its about 1000 units on -Z so its quite far in my case but still clearly visible! now when I move the planes nose up slowly looking all the time at the vertical line in front of me I can see on the window that the line obviously doesn''t move it stays at the same position only plane moves. so on the window I can see the line moving down when you reverse physics ie. line moves plane doesn''t. when I move the plane nose up slowly the line moves smoothly down the window but when I do same thing quickly then the line appears to vibrate ie. slightly going one unit up and down. It does that quickly so all you can see is a blured double line. When I slow down again it becomes more visible and I can see just one line. I know it might be funny but its quite annoying!! May be you guys had same thing and can help me!! Do you think this is caused coz of my plane movements?
Advertisement
It sounds to me like there''s a limiter somewhere in your code to slow down the movement of the plane, like :
  if (AddToPitch > 90) AddToPitch = 90;  

if there is this in the code, make sure it is before any rotations and before you draw the scene, or it will rotate, then draw, then modify the pitch, so the next frame will be out of wack.
Hope this helps.

email

Something kinda sad about
the way that things have come to be.
Desensitized to everything.
What became of subtlety?
--Tool

[email=JValentine_13@hotmail.com]contact[/email]
Yes! exactly! Thats what I use but its done in the function below! ie. every time I press an arrow the glutPostRedisplay is called to redraw all again so I think its before anythingelse happens! am I right do you think?

void ArrowKeys(int key, int x, int y)
{
switch (key)
{

case GLUT_KEY_DOWN: if( MouseY < 800.0) {MouseY += 20.0;}
glutPostRedisplay();
break;
case GLUT_KEY_UP: if( MouseY > -800.0) {MouseY -= 20.0;}
glutPostRedisplay();
break;
case GLUT_KEY_LEFT: if( MouseX > -1000.0) {MouseX -= 50.0;}
glutPostRedisplay();
break;
case GLUT_KEY_RIGHT: if( MouseX < 1000.0) {MouseX += 50.0;}
glutPostRedisplay();
break;
}
}
I''ve never used GLUT myself, but if I''m correct, you might want to wait until all physics code has run before calling glutPostRedisplay()
instead of having it in each case, I would put it at the very end of each program main loop.
For example
  int main(){   while(bGameRunning)   {      // Do key input/player physics      // Do NPC/AI moves and physics      glutPostRedisplay();   }}  


and comment out all other references to glutPostRedisplay()
I believe that gluPostRedisplay is similar to swapping the buffers without GLUT
If nothing else, it would improve your FPS because, as it is now, only one screen transformation is taking place per frame.


email

Something kinda sad about
the way that things have come to be.
Desensitized to everything.
What became of subtlety?
--Tool

[email=JValentine_13@hotmail.com]contact[/email]
Ok! thx Lord Karnus!!
I''ll do that and c what happens!!
Thank you!!

This topic is closed to new replies.

Advertisement