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.