Hey, I am producing an OpenGL application on netbeans and am having an issue rendering a graphic at

Hey, I am producing an OpenGL application on netbeans and am having an issue rendering a graphic at the appropriate coordinates when triggered by a MotionEvent.ACTION_DOWN

The first bit of code is from my main project that would gather the coordinates when someone touches the screen:



public boolean onTouchEvent(MotionEvent event) {

switch (event.getAction()) {

case MotionEvent.ACTION_MOVE:

//renderer.move(event.getX() - touchStart.x, touchStart.y - event.getY());

//touchStart.set(event.getX(), event.getY());

glSurfaceView.requestRender();

return true;



case MotionEvent.ACTION_DOWN:

//touchStart.set(event.getX(), event.getY());

//renderer.move(event.getX() - touchStart.x, touchStart.y - event.getY());

//renderer.move(touchStart.x, touchStart.y);

renderer.move(event.getX(), event.getY());

glSurfaceView.requestRender();

Log.d(“ActionDown”, “offset=[” + event.getX() + “, " + event.getY() + “]”);

//new AlertDialog.Builder(this).setTitle(“Alert”).setMessage(“x=” + event.getX() + " y=” + event.getY() + " .").setNeutralButton(“Close”, null).show();

//touchStart.set(event.getX(), event.getY());

return true;



default:

return super.onTouchEvent(event);

}

}













renderer.move is called with parameters x and y, and after testing I find that these values remain constant while passing through functions. The move command is as follows:



public void move(float xDelta, float yDelta) {

offset.x = xDelta;

offset.y = yDelta;

Log.d(“TriangleRenderer”, “offset=[” + offset.x + ", " + offset.y + “]”);

}

}









and the translation happens when the scene is drawn:



public void onDrawFrame(GL10 gl) {

gl.glPushMatrix();



gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

gl.glTranslatef(offset.x, offset.y, 0);

gl.glColor4f(1.0f, 0.3f, 0.0f, .5f);

gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

gl.glVertexPointer(3, GL10.GL_SHORT, 0, triangleBuffer);

gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 3);

gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);



gl.glPopMatrix();

}











Am I missing something fundamental here? If there is anything else you need to help diagnose the issue please do not hesitate to ask! Thanks!

We are neither NetBeans nor OpenGL support here :?