   baby programmer here...(moving balls?)
  Ok im very new to programming, only in 2nd year of studies in it - C++ and openGL.i dont know very much about programming principles and woud like to know if some someone could help me with a problem.i've been set a task at university to implement a very simple snooker game involving 2 balls and some pockets.i've managed to implement classes for everything i need and draw it on screen, and have created ample functions for collision detection, the only thing i've came to a halt at is......how to actually move the balls?!?i have a class for the balls (glDisk's) which uses vector positions, and i want to add a vector velocity to it and make it mvoe on the screen, i also have variables for friction.could someone please advise on how to implement simple movement of balls in openGL , C++.i have absolutely no idea?.   
  A simple algorithm would be:Ball::Render( ) {  t = CurrentTime( );  c = this->Position( t );  this->RenderAtPosition( c );}You already know how to render at a position, all you have to do is create a function that gives you the position of the ball at a given time. This should be pretty easy to find out from your physics formulas (or at least, a good approximation of it).   ;  What are our universities up to?You're in your second year and you don't know how to add a velocity vector to a position vector?I imagine most of the hobbyist programmers here could do that without even thinking about it.Although there are a few good programmers coming out of university, I still see some unbelievably bad candidates coming out of universities and expecting top jobs in specialised roles.Sickening!;  Come on AP! Shut up!   ;  I am not fluent with OpenGL but I would imagine its something like this.// Movement function.Vector position(x,y,z);Vector velocity(speedx,speedy,speedz);// Other calculations, friction, etc.// Then in the render function.ball->draw(position+velocity);Of course in my example you would need a Vector class and overloaded + operator.Ultimate Game Programming has a great section on OpenGL with various demos with code. I suggest you check there if your really lost.   ;Quote:Original post by Anonymous PosterYou're in your second year and you don't know how to add a velocity vector to a position vector?What kind of physical sense does it make to add together a velocity and a position? None whatsoever, they're not even compatible units. It works because it's a hack. That's right, an ugly hackish specialization of the Euler integration method (which does make physical sense) that was hand-optimized and passed on for generations of game programmers, and if a general university wastes time teaching all its second year students about Euler integration when it should be mentioning data structures, language programming basics, software engineering, linear programming, networking and operating systems, and general algorithms, then I would definitely not want to get anywhere near that university.Besides, it's not a question of requiring intelligence to solve a problem: using euler integration for a billiards game makes no sense either - except if it's the only method you know for integrating a position based on acceleration. Runge-kutta integration is much better, and so would be Verlet (as far as discrete time integration methods go). And even then, I see no reason to use discrete time integration methods to solve this problem at all, since it can be so easily and elegantly expressed as a sequence of time-based differential equations and solved with perfect accuracy (unlike discrete time integration methods) at any replay speed (including slow motion and rewind) using formal computations and minimal memory.So, in the end, you seem to be expecting of a second-year student in what appears to be a general university one:either the teacher-given knowledge of an obscure discrete integration method that is used as a naive optimization in video games, but would most likely be of strictly no use whatsoever to 95% of existing programmers.or the ability to find on his own, using problem-solving skills and his intelligence, a "solution" that is highly unadapted to the problem at hand, when more elegant solutions can be easily derived from the simple formulas describing billiards. Such expectations are narrow, and dangerous.Most hobby programmers here would do it without thinking - and they would never land a job if I can have a word in it, because applying without thinking is an incredibly bad idea. Euler interpolation is the do-all end-all solution to movement in video games that works can be applied everywhere without getting errors that are too large. But it is highly unstable (and non-deterministic as soon as floating-point is involved), strictly inferior in terms of precision and physical meaning to Runge-Kutta integration, and does not stand even the smallest chance against a priori Netwon-based formal constraint solving (which, incidentally, in the case of billiards, would be just as fast - if not faster - than discrete time integration because of the simple physical description of the problem).   