push ball opengl

Problems with Canvas, OpenGL, etc...

push ball opengl

Postby piyush_b » Wed Mar 02, 2011 3:28 pm

i am working on some ball game , where i need to push the ball in the -z (negative) axis. this is 1st time i am working on opengl game. So plz tell me which method to use in order to throw or push ball at the -z direction i.e like we are throwing ball away from the screen or inside the screen........ it will look like ball is moving away.
piyush_b
Freshman
Freshman
 
Posts: 3
Joined: Wed Mar 02, 2011 3:07 pm

Top

Re: push ball opengl

Postby fps6 » Wed Mar 02, 2011 3:35 pm

Code: Select all
gl.glTranslatef(x, y, z);


float numbers, gl is the method parameter

Code: Select all
public void onDrawFrame(GL10 gl)
fps6
Freshman
Freshman
 
Posts: 4
Joined: Sun Feb 27, 2011 2:01 am

Re: push ball opengl

Postby piyush_b » Wed Mar 02, 2011 3:41 pm

hey fps6 thnx for ur reply, but can u plz give me some snipetts for this...... to understand exactly how to go bout it....
piyush_b
Freshman
Freshman
 
Posts: 3
Joined: Wed Mar 02, 2011 3:07 pm

Re: push ball opengl

Postby fps6 » Wed Mar 02, 2011 3:50 pm

Code: Select all
public void onDrawFrame(GL10 gl)
       {          
          gl.glPushMatrix();
          gl.glTranslatef(1.0f, 1.0f, -2.0f);
          player.draw(gl);   //Draw the square
          gl.glPopMatrix();
        }


http://blog.jayway.com/2009/12/04/openg ... a-polygon/
fps6
Freshman
Freshman
 
Posts: 4
Joined: Sun Feb 27, 2011 2:01 am

Re: push ball opengl

Postby piyush_b » Wed Mar 02, 2011 3:57 pm

hey thnx for ur assistance......... :)
piyush_b
Freshman
Freshman
 
Posts: 3
Joined: Wed Mar 02, 2011 3:07 pm

Re: push ball opengl

Postby fps6 » Wed Mar 02, 2011 4:04 pm

no problem, good luck ;)
fps6
Freshman
Freshman
 
Posts: 4
Joined: Sun Feb 27, 2011 2:01 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest