saiabhishek
02-24-2012, 02:44 AM
Hi,
i have drawn an square,now i want to move it along the plane following the mouse pointer.I am using open GL es 1.0.I tried to get difference in motion position with the below code.
-----------------------------------------
public boolean onTouchEvent(MotionEvent e) {
float x = e.getX();
float y = e.getY();
switch (e.getAction()) {
case MotionEvent.ACTION_MOVE:
mRenderer.dx = x - mPreviousX;
mRenderer.dy = y - mPreviousY;
requestRender();
}
mPreviousX = x;
mPreviousY = y;
return true;
}
----------------------------------------------------
and then i am translating the object by using gtranslatef function with dx and dy values.
gl.glTranslatef(dx, dy,0);
but for a little movement in mouse pointer.there is large displacement in object position.
How can i move object along with mouse.Please help me to get out of this.
i have drawn an square,now i want to move it along the plane following the mouse pointer.I am using open GL es 1.0.I tried to get difference in motion position with the below code.
-----------------------------------------
public boolean onTouchEvent(MotionEvent e) {
float x = e.getX();
float y = e.getY();
switch (e.getAction()) {
case MotionEvent.ACTION_MOVE:
mRenderer.dx = x - mPreviousX;
mRenderer.dy = y - mPreviousY;
requestRender();
}
mPreviousX = x;
mPreviousY = y;
return true;
}
----------------------------------------------------
and then i am translating the object by using gtranslatef function with dx and dy values.
gl.glTranslatef(dx, dy,0);
but for a little movement in mouse pointer.there is large displacement in object position.
How can i move object along with mouse.Please help me to get out of this.