game: display a ball using opengl

Apprentice
Posts: 6
Joined: 2008.09
Post: #1
can any one help me with how to display a 2d or 3d circle or ball. using opengles frame work .

how to move the ball using the acclerometer

and how collision between balls to be programmed
Quote this message in a reply
Member
Posts: 53
Joined: 2007.08
Post: #2
Gonna have to be more specific. What API are you using?

If you haven't chosen one, don't know what one is, and/or are complety new to game programming, take a gander at http://www.idevgames.com/forum/showthread.php?t=11896 to help point you in the right direction.
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #3
Displaying a 2D circle or ball is *extremely* basic. Read some basic tutorials.

As far as collision detection, just use the distance formula from high school algebra:

dist = sqrt(x2-x1 * x2-x1 + y2-y1 * y2-y1)

if (dist < (radiusObj1 + radiusObj2) then collision occurred.

For 3D, just add the z term to the distance equation.
Quote this message in a reply
Apprentice
Posts: 6
Joined: 2008.09
Post: #4
for iphone game development , i am using opengl es frame work .
by default a rotating square is displayed in the opengles template of iphone sdk. i need a circle or a ball.
i have read basic tutorials but for ball can any one point out any tutorials as it differs for opengles
Quote this message in a reply
Post Reply