PDA

View Full Version : Billiards game centre cue on ball



Edney86
03-13-2010, 05:27 AM
Hi guys,

Can anyone help, I have written a program for a billiards game,I have the cue moving of external hardware through the serial port.
The Ball is centred at BallPos->x, BallPos->y,BallPos->z.

I have drawn the cue with the following code;

glTranslatef(CuePos->x+CueBallposition->x,CuePos->y+CueBallposition->y,CuePos->z);

gluCylinder(g_quadratic,0.1,1.0,15,50,50);
glTranslatef(0.0,0.0,15);
gluDisk(g_quadratic,0,1.0,16,16);
glPopMatrix()

I just cant seem to get the tip of the cue to always go towards the ball!

Can anyone help?

Thanks

Ehsan Kamrani
03-13-2010, 07:03 AM
Where's glPushMatrix() ?