Code uses OpenGL 1.0 instead of 2.0

Started by zammbi, July 11, 2012, 05:43:06 AM

Previous topic - Next topic

zammbi

I'm suck on an interesting issue.

For inputting on CricHQ we need our the 3d to load as fast as possible so I have currently moved it to OpenGL 1.0 (the shaders were slowing resume on all devices too much).
Then for viewing the data I use OpenGL 2.0 so I have AA.

But I've found that turning on OpenGL 2.0 after 1.0 crashes (though opening 1.0 after 2.0 doesn't crash).
All the OpenGL 2.0 code runs without error which makes it hard to prevent the crash.

mGLView.setEGLContextClientVersion(2);
AAConfigChooser aa = new AAConfigChooser(mGLView, true);
mGLView.setEGLConfigChooser(aa);


Quote07-11 15:35:15.725: I/jPCT-AE(9101): onCreate
07-11 15:35:16.319: I/jPCT-AE(9101): MSAA enabled with 2 samples!
07-11 15:35:16.319: I/jPCT-AE(9101): Unable to find a matching config...using default!
07-11 15:35:16.444: I/jPCT-AE(9101): Initializing GL20 render pipeline...
07-11 15:35:16.452: I/jPCT-AE(9101): Accessing shaders via JAR!
07-11 15:35:16.460: I/jPCT-AE(9101): [ 1341977716469 ] - ERROR: Shaders are not supported when using OpenGL ES 1.x!
07-11 15:35:16.483: I/jPCT-AE(9101): [ 1341977716495 ] - ERROR: java.lang.RuntimeException: [ 1341977716469 ] - ERROR: Shaders are not supported when using OpenGL ES 1.x!
07-11 15:35:16.483: I/jPCT-AE(9101):    at com.threed.jpct.Logger.log(Logger.java:189)
07-11 15:35:16.483: I/jPCT-AE(9101):    at com.threed.jpct.GLSLShader.check20(GLSLShader.java:266)
07-11 15:35:16.483: I/jPCT-AE(9101):    at com.threed.jpct.GLSLShader.<init>(GLSLShader.java:217)
07-11 15:35:16.483: I/jPCT-AE(9101):    at com.threed.jpct.GL20.<init>(GL20.java:117)
07-11 15:35:16.483: I/jPCT-AE(9101):    at java.lang.Class.newInstanceImpl(Native Method)
07-11 15:35:16.483: I/jPCT-AE(9101):    at java.lang.Class.newInstance(Class.java:1319)
07-11 15:35:16.483: I/jPCT-AE(9101):    at com.threed.jpct.GLRenderer.init(GLRenderer.java:374)
07-11 15:35:16.483: I/jPCT-AE(9101):    at com.threed.jpct.GLRenderer.init(GLRenderer.java:364)
07-11 15:35:16.483: I/jPCT-AE(9101):    at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:90)
07-11 15:35:16.483: I/jPCT-AE(9101):    at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:115)
07-11 15:35:16.483: I/jPCT-AE(9101):    at nz.co.nuffie.android.crichq.threedimensional.World3dBase.onSurfaceChanged(World3dBase.java:468)
07-11 15:35:16.483: I/jPCT-AE(9101):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1456)
07-11 15:35:16.483: I/jPCT-AE(9101):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1217)
07-11 15:35:16.499: I/jPCT-AE(9101): [ 1341977716506 ] - ERROR: java.lang.RuntimeException: [ 1341977716495 ] - ERROR: java.lang.RuntimeException: [ 1341977716469 ] - ERROR: Shaders are not supported when using OpenGL ES 1.x!
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.Logger.log(Logger.java:189)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.GLSLShader.check20(GLSLShader.java:266)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.GLSLShader.<init>(GLSLShader.java:217)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.GL20.<init>(GL20.java:117)
07-11 15:35:16.499: I/jPCT-AE(9101):    at java.lang.Class.newInstanceImpl(Native Method)
07-11 15:35:16.499: I/jPCT-AE(9101):    at java.lang.Class.newInstance(Class.java:1319)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.GLRenderer.init(GLRenderer.java:374)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.GLRenderer.init(GLRenderer.java:364)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:90)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:115)
07-11 15:35:16.499: I/jPCT-AE(9101):    at nz.co.nuffie.android.crichq.threedimensional.World3dBase.onSurfaceChanged(World3dBase.java:468)
07-11 15:35:16.499: I/jPCT-AE(9101):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1456)
07-11 15:35:16.499: I/jPCT-AE(9101):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1217)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.Logger.log(Logger.java:189)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.Logger.log(Logger.java:136)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.GLRenderer.init(GLRenderer.java:376)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.GLRenderer.init(GLRenderer.java:364)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:90)
07-11 15:35:16.499: I/jPCT-AE(9101):    at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:115)
07-11 15:35:16.499: I/jPCT-AE(9101):    at nz.co.nuffie.android.crichq.threedimensional.World3dBase.onSurfaceChanged(World3dBase.java:468)
07-11 15:35:16.499: I/jPCT-AE(9101):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1456)
07-11 15:35:16.499: I/jPCT-AE(9101):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1217)


EgonOlsen

Are you using the different constructors of FrameBuffer for 1.x and 2.0?

zammbi

Yes. I switch OpenGL correctly, just doesn't seem to work after I've used OpenGL 1.X

EgonOlsen

I can't find a reason for this...the check in check20() that triggers this error is based on the variable that will be set when creating the FrameBuffer. I don't see how this should fail if you are using a new instance of FrameBuffer. Can you post some code to show what you are actually doing?

zammbi

What if the old FrameBuffer is still in memory would that do it?

EgonOlsen

I don't see how...can you post the log output...maybe with the Logger being set to debug?


zammbi

I don't know what you did, but it works now ;D

Thanks for the quick fix.

zammbi

#8
Except that the beta is buggy  :-\
On a Samsung tablet 10.1 the whole 3d view spazzed out. This image shows me zooming in, causing a ghosting effects over the screen.



With my quick test it seemed to be only for OpenGL 1.0

EgonOlsen

I don't know of any changes between the last official version and this one that may cause this. Does this happen when solely using 1.x too? Or only when switching from 2.0 to 1.x in the process?

zammbi

I've currently reverted back to the stable version. Can't do any more testing today.
It happened on the Android 3 tablet. It showed only after a while of testing. I didn't notice this on any other device, however my tests were quick.
This build had the OpenGL switching. I don't know if it happened just solo OpenGL 1.x.

EgonOlsen

Quote from: zammbi on July 12, 2012, 07:22:18 AM
This build had the OpenGL switching. I don't know if it happened just solo OpenGL 1.x.
That would be worth a try, because i find this OpenGL-version-switch idea highly dubious anyway and my gut feeling actually says, that it's asking for trouble...but that's not based on anything other than bad experience with similar approaches and might not apply here.