Here's my program. The floats x and y draw the ball at 0,0 as that is their constant values. gltranslatef then translates up 0.1 in the positive y direction every time the animation loop comes around. This results in the ball slowly moving up the window until it dissapears. Printf then prints the values of x and y every time to show that they are always 0.
My problem is that if my original coordinates are 0,0 then I can't use those to detect collisions because I use gltranslatef for movement instead of just writing new coordinates every time.
So gltranslatef only tells me that it has move 0.1 in the positive y direction.
I don't understand how to detect collisions when there is no way (that I know of) of knowing the coordinates of the ball in the window, thus not being able to know if it is colliding with the top or a certain point.
This is certainly not pong, but it does simulate how I've understood a ball should move when animated.
Thanks for this - this forum is too kind .
printf("%f\n\n%f\n\n", x , y);
int main(int argc, char **argv)
x = 0.0;
y = 0.0;
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);