View Full Version : Motion problems.

01-14-2002, 11:33 AM
I am currently developing a chess board using opengl to kill some time. However I have come upon a snag when I tried to get the pieces to move slowly from one position to another rather than just flashing into place. Here is what I am doing:
-- I draw the board.
-- I draw the pieces.
-- When a piece moves, I simply reset the state of the board so in the next frame refresh the change is reflected.

However in the update to sliding pieces the steps are in a loop:

-- I draw the board
-- I draw all of the pieces except the moving one
-- Translate to the position of the moving piece.
-- Translate the distance of one step based on the loop counter.
-- Draw the moving piece.

I assumed that in the loop the piece would move slowly from it's current position to the new one. It doesen't happen that way however, I get the delay from the loop, but the piece stays put, and then snaps into place after the delay is over. I was wondering if anyone could help me with this.

01-14-2002, 04:28 PM
Are you refreshing after each move of the piece. If you are using the Win32 API and a double buffered window you need to call SwapBuffers before it will update
also try glFlush or glFinish, those might work

01-14-2002, 05:08 PM
Yep, that fixed it thanks.