Hello
Initially things were being rendered correctly. But then i soon noticed some mis-matches in objects rendered. I wasn't aware exactly when it started that way,
but when i started tracing data... I realised its because my renderer constructor is called twice , because the data printouts of all function-calls within the renderer constructor print out twice. But i only called it once
In fact i think all funtion-calls within the renderer class are called twice because when i moved the function-calls to onDrawFrame(GL10 gl) same problem occured
public class MyGLSurfaceView extends GLSurfaceView {
public int n = 16, t=0, r=0;
public MyGLSurfaceView(Context context, AttributeSet attrs ) {
super(context, attrs);
setRenderer(new MyGLRenderer(context, n, t )); // renderer called once
}
}
public class MyGLRenderer implements GLSurfaceView.Renderer {
Context context; // Application's context
private mObjects Objs;
public MyGLRenderer(Context context, int NumOfData, int dataType ) { // implemented once
Objs = new mObjects( NumOfData, dataType );
Objs.customAxesWBL();
Objs.customAxesBL();
Objs.callByteBufferLoop(NumOfData);
}
.....
To get my renderer outputs right now i have to place the if statement below around all code within the affected functions so the algorithms run just once. Then the output was fixed. But why should i have to put such ugly if statement around the algorithms?
if ( Globals.customAxesBL_Once == 0 ){
Globals.customAxesBL_Once = 1;
......
}
Anyone experienced this before? Whats the cause? Any way to fix it?
Many thanks