Author Topic: GLSurfaceView.setEGLContextClientVersion  (Read 1602 times)

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
GLSurfaceView.setEGLContextClientVersion
« on: December 18, 2013, 12:40:58 pm »
adding this line to HelloWorld sample before setEGLConfigChooser

Code: [Select]
mGLView.setEGLContextClientVersion(2);
results in the exception below. any ideas how to fix this?

Code: [Select]
I/jPCT-AE (24633): Memory usage after compacting: 12335 KB used out of 13447 KB. Max. memory available to the VM is 65536 KB.
I/jPCT-AE (24633): Saving master Activity!
E/libEGL  (24633): called unimplemented OpenGL ES API
E/libEGL  (24633): called unimplemented OpenGL ES API
E/libEGL  (24633): called unimplemented OpenGL ES API
I/jPCT-AE (24633): [ 1387365972966 ] - WARNING: State: 0/0/0/0/0/0/0
W/dalvikvm(24633): threadid=11: thread exiting with uncaught exception (group=0x4199d2a0)
E/AndroidRuntime(24633): FATAL EXCEPTION: GLThread 7949
E/AndroidRuntime(24633): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
E/AndroidRuntime(24633):        at com.threed.jpct.CompiledInstance._fill(CompiledInstance.java:1206)
E/AndroidRuntime(24633):        at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:746)
E/AndroidRuntime(24633):        at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:148)
E/AndroidRuntime(24633):        at com.threed.jpct.World.compile(World.java:1951)
E/AndroidRuntime(24633):        at com.threed.jpct.World.renderScene(World.java:1046)
E/AndroidRuntime(24633):        at com.threed.jpct.example.HelloWorld$MyRenderer.onDrawFrame(HelloWorld.java:228)
E/AndroidRuntime(24633):        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
E/AndroidRuntime(24633):        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: GLSurfaceView.setEGLContextClientVersion
« Reply #1 on: December 18, 2013, 02:39:25 pm »
Just use the other constructor for FrameBuffer. You are using the 1.x variant in a 2.0 context, which doesn't work because the whole gl API has changed between 1.x and 2. Sadly, i can't really detect the current version, so it's left to you to do the 'right thing'.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: GLSurfaceView.setEGLContextClientVersion
« Reply #2 on: December 18, 2013, 03:04:49 pm »
thanks, that solved it :)

btw, does FrameBuffer.blit(Texture, ..) hold a reference to blitted Texture? I'm continously creating a bitmap, then a texture from that bitmap, and blit it and eventually end up with out of memory.

if I omit texture creation and create bitmap and blit last texture no out of memory happens

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: GLSurfaceView.setEGLContextClientVersion
« Reply #3 on: December 18, 2013, 04:05:51 pm »
No, it holds no reference to it but it uploads it to the GPU. If you aren't using a texture any longer, you should unload it so that the memory used on the GPU will get freed.

Edit: A better solution would be to use an ITextureEffect for this though.
« Last Edit: December 18, 2013, 04:07:24 pm by EgonOlsen »