mandala icon indicating copy to clipboard operation
mandala copied to clipboard

Support for OpenGLES3 ?

Open tbruyelle opened this issue 11 years ago • 8 comments
trafficstars

Hi Andrea,

I currently have a desktop application coded under OpenGL3 [1], and I want to embed it into Mandala [2]. Because the desktop version is based on go-gl/gl, I couldn't use remogatto/opengles2, there was too much changes. So I cloned go-gl/gl and hardly delete the code that doesn't exist in the OpenGLES implementation. I tried first to compile under OpenGLES2 but I finally get stuck because of missing methods about vertex arrays (glBindVertexArray etc...). Indeed those methods are only here since OpenGLES3. So I switched to OpenGLES3 but I still have compilation errors about the same methods.

Si I wonder if Mandala can support OpenGLES3 ?

[1] https://github.com/tbruyelle/gostuff/tree/opengl3/games/mozaik [2] https://github.com/tbruyelle/mozaik

tbruyelle avatar Jun 03 '14 12:06 tbruyelle

Is OpenGLES3 widely supported on Android devices?

http://developer.android.com/guide/topics/graphics/opengl.html

This doesn't answer to your specific question... but just wondering before thinking of a possible solution.

remogatto avatar Jun 03 '14 13:06 remogatto

Yes I know that, and that's a problem. But currently I'm focusing on running my app on an android device, regardless a wide support.

By the way, I noticed the vertex arrays methods are declared in gl2ext.h, with the OES suffix. So normally I should be able to use OpenGLES2 within my app. But :

$ gotask build android --flags "-a"
# github.com/tbruyelle/gl
/home/tom/android-ndk-r9d/ndk-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: $WORK/github.com/tbruyelle/gl/_obj/vertexarray.cgo2.o: in function _cgo_c921059ada17_Cfunc_glBindVertexArrayOES:/home/tom/go/src/github.com/tbruyelle/gl/vertexarray.go:36: error: undefined reference to 'glBindVertexArrayOES'
/home/tom/android-ndk-r9d/ndk-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: $WORK/github.com/tbruyelle/gl/_obj/vertexarray.cgo2.o: in function _cgo_c921059ada17_Cfunc_glDeleteVertexArraysOES:/home/tom/go/src/github.com/tbruyelle/gl/vertexarray.go:46: error: undefined reference to 'glDeleteVertexArraysOES'
/home/tom/android-ndk-r9d/ndk-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: $WORK/github.com/tbruyelle/gl/_obj/vertexarray.cgo2.o: in function _cgo_c921059ada17_Cfunc_glGenVertexArraysOES:/home/tom/go/src/github.com/tbruyelle/gl/vertexarray.go:56: error: undefined reference to 'glGenVertexArraysOES'
collect2: ld returned 1 exit status
exit status 2
cp: cannot stat ‘bin/linux_arm/myapp’: No such file or directory
exit status 1
cp: cannot stat ‘bin/linux_arm/myapp’: No such file or directory
exit status 1
FAIL        Build the application for the given platforms.
2014/06/03 16:30:21 exit status 1

If you try to reproduce the result, the repo tbruyelle/gl has 2 branches : opengles2 and opengles3, so you can switch from one to another. In the opengles2 branch, the vertex arrays methods are declared with the OES suffix.

tbruyelle avatar Jun 03 '14 14:06 tbruyelle

Any chance to replace glBindVertexArray with something else?

remogatto avatar Jun 05 '14 11:06 remogatto

Well I'm an OpenGL noob and I don't know how I can replace the usage of vao. The only place where I use it is here. It's a common method which is invoked by all my objects.

BTW, do you know why the project doesn't compile even if I switch to OpenGLES2 and replace the vertex array methods by their OES extension version ?

tbruyelle avatar Jun 05 '14 13:06 tbruyelle

Google says this:

https://www.google.it/#q=android+ndk+glBindVertexArrayOES

Is that of any help?

Moreover, I'm using vertex arrays in this way:

https://github.com/remogatto/mandala-examples/blob/master/cube/src/cubelib/cube.go#L188

EDIT: reference to cube.go

remogatto avatar Jun 05 '14 14:06 remogatto

Yeah I know that, to enable vertex arrays OES extension, the flag GL_GLEXT_PROTOTYPES must be set. I had to do that even to compile tbruyelle/gl in the opengles2 branch.

See in https://github.com/tbruyelle/gl/blob/opengles2/gl.h

I looked at the version of gl2ext.h in my NDK toolchain, and the flag is the same, so it should work.

tbruyelle avatar Jun 06 '14 08:06 tbruyelle

I'll take a look at your code ASAP. BTW, I think that the quickest way to fix the issue is to try avoiding the use of such OES extension.

remogatto avatar Jun 06 '14 09:06 remogatto

Ok thank you !

2014-06-06 11:33 GMT+02:00 Andrea Fazzi [email protected]:

I'll take a look at your code ASAP. BTW, I think that the the quickest way to fix the issue is to try avoiding the use of such OES extensions.

— Reply to this email directly or view it on GitHub https://github.com/remogatto/mandala/issues/10#issuecomment-45319089.

tbruyelle avatar Jun 06 '14 12:06 tbruyelle