Author Topic: Code uses OpenGL 1.0 instead of 2.0  (Read 2836 times)

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Code uses OpenGL 1.0 instead of 2.0
« on: July 11, 2012, 05:43:06 am »
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.

Code: [Select]
mGLView.setEGLContextClientVersion(2);
AAConfigChooser aa = new AAConfigChooser(mGLView, true);
mGLView.setEGLConfigChooser(aa);

Quote
07-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)


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #1 on: July 11, 2012, 07:14:20 am »
Are you using the different constructors of FrameBuffer for 1.x and 2.0?

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #2 on: July 11, 2012, 03:57:15 pm »
Yes. I switch OpenGL correctly, just doesn't seem to work after I've used OpenGL 1.X

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #3 on: July 11, 2012, 04:20:29 pm »
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?

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #4 on: July 11, 2012, 11:53:58 pm »
What if the old FrameBuffer is still in memory would that do it?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #5 on: July 11, 2012, 11:58:15 pm »
I don't see how...can you post the log output...maybe with the Logger being set to debug?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #6 on: July 12, 2012, 12:07:29 am »

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #7 on: July 12, 2012, 12:41:31 am »
I don't know what you did, but it works now ;D

Thanks for the quick fix.

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #8 on: July 12, 2012, 06:19:25 am »
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
« Last Edit: July 12, 2012, 06:23:46 am by zammbi »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #9 on: July 12, 2012, 07:10:30 am »
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?

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #10 on: July 12, 2012, 07:22:18 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Code uses OpenGL 1.0 instead of 2.0
« Reply #11 on: July 12, 2012, 07:25:25 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.