PDA

View Full Version : OpenGL and SDL



Lurking
06-05-2003, 11:37 PM
im writing a really basic program using opengl and sdl. the problem is that it the rotating cube only turns when you move the mouse and stop when the mouse stops. what could be stopping this from doing it? Im following the instructions from the sdl site and i cant see why its just refreshing when the mouse moves.

jide
06-06-2003, 02:17 AM
you just forgot your animation cycle.. try to have an idle time function just calling to render.

nexusone
06-06-2003, 04:39 AM
You cube only rotates in the mouse routine because it is the only place it is being called to be updated.

Switch from updating the display from the mouse routine, into a timer function or idle function.

Every X seconds update the screen, not sure about it in SDL, but look under timmer events in SDL.

void My_animation( void )
{
// X seconds passed
updateDisplay();
}



Originally posted by Lurking:
im writing a really basic program using opengl and sdl. the problem is that it the rotating cube only turns when you move the mouse and stop when the mouse stops. what could be stopping this from doing it? Im following the instructions from the sdl site and i cant see why its just refreshing when the mouse moves.