move objet in opengl application

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

move objet in opengl application

Postby dgnakouri » Mon Apr 19, 2010 8:43 am

Hi
I start to developpe in opengl and I arrived drew a square that I'd like to move with the method onTouchEvent
this my code

cl
ass ClearGLSurfaceView extends GLSurfaceView {
public ClearGLSurfaceView(Context context) {
super(context);
mRenderer = new ClearRenderer();
setRenderer(mRenderer);
}

public boolean onTouchEvent(final MotionEvent event) {
queueEvent(new Runnable(){
public void run() {
mRenderer.setColor(event.getX() / getWidth(),
event.getY() / getHeight(), 1.0f);

float tmpX = (event.getX()-getWidth())/getWidth();
float tmpy = (getHeight()-event.getY())/getHeight();
mRenderer.setXY(event.getX()-event.getY());
//Toast.makeText(getContext(),event.getX()+" "+event.getY(), Toast.LENGTH_SHORT).show();
}});
return true;
}


ClearRenderer mRenderer;
}


when i click in my surface my sqare disapear
came you help me
thanks
dgnakouri
Freshman
Freshman
 
Posts: 4
Joined: Mon May 25, 2009 11:11 am

Top

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

Who is online

Users browsing this forum: Google Feedfetcher and 5 guests