Hello seed,
thanks very much for trying to help..
the action is really simple, and I am surprised I still couldnt get it to work the way I wanted.
Let me give you a few details of the code.
The activity has 2 buttons, and 1 view that extends glsurfaceview.
Button zoomin calls this method defined in the extended glsurfaceview:
public void zoomIn() {
queueEvent(new Runnable() {
@Override
public void run() {
renderer.zoomIn(1.0f);
}
});
}
And in the renderer class this is the called method:
public void zoomIn(float forw) {
eye+=forw;
}
which updates
private float eye ;
..and :
@Override
public void onDrawFrame(GL10 gl) {
// Clear the screen to blue
gl.glClearColor(0.0f, 0.0f, 1.0f, 0.0f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
// Position model so we can see it
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0, 0, eye-4.0f);
cube.draw(gl);
}
As I said, the only way i got this to work was detecting the ontouchevent on the glsurfaceview, and binding the rest of my code there.
I know this will sound trivial to most of you reading this.. but I have only started with openGL a few days ago..
I guess Im just missing something really obvious..?
again, thanks very much for any help you could give...
thanks
N
seed wrote:Sure it is possible. Curious. Did you debug it? Seems like a quick problem to find with a little debugging.
If the action is as simple as changing an atomic variable for something like zoom, then just setting a member variable for zoom in the renderer class will work fine rather than queing events. Some people write whole games without any queued events between threads. Not recommending this. Just saying. Maybe just do this as a test if you are resistant to bad coding practices that idiots like me on the forum recommend.
