Cocos2dx and OpenGL es 3.0

Where can I find good tutorials about writing games that contain both cocos2dx and OpenGL es 2.0 or 3.0?

Currently, cocos only supports es 2.0.

zhangxm, can you please explain how to compile cocos for open gl es2?

Just compile it :wink:

I compiled it but it says “not yet ready openGL1.5 needs openGL2”. then tests run with no acceleration.
I am compiling it on orange pi zero plus 2 H3. (Allwinner ARM H3 armv7) That has openGL ES 2 working.
That same board has Android, and the apk runs very well and is accelerated.
I need to get it to work under Armbian with openGL ES 2.
It was a long process to compile it and I feel I am close to get it to work. Any help is GREATLY appreciated.
Using cocos2d-x-3.15.1

zhangxm, can you please explain how to compile it for es 2? I am compiling on a system that has open GL ES2 and simulated open GL 1.5, is there a way to get accelerated cocos2dx on it?

Cocos2d-x v3.x supports ES 2, what’s your problem?

Thank you for the fast reply. It compiles but cpp-tests run without acceleration. I am compiling again to try again. On this board, dri2 is used for openGLES2, I think cocos uses mesa, could this be the problem?
Here are more details:
orangePi zero plus2 H3 board (armv71)
Armbian: ubuntu 16.04.2 LTS
es2gears runs accelerated and reports: EGL_VERSION = 1.4 Linux-r3p0-04re10
using cocos2d-x-3.15.1

Sorry, i don’t quite understand the issue. What did you do to accelerate the engine? I don’t find what’s the special operation.

Sorry, maybe I am not explaining the issue correctly. Here is the problem: It compiles and cpp-tests run, but they are not accelerated, as if it is not using openGLES2. This board uses dri2 drivers not mesa, maybe that’s the reason? if so, can we make cocos use dri2? Or maybe there is some flag that I need to specify on compile to use GLES2?

I just finished compiling a fresh copy of cocos2d-x-3.15.1

cpp-tests runs without acceleration. here is the output :

gs@orangepizeroplus2:~/cocos2d-x-3.15.1/linux-build/gsbuild1/bin/cpp-tests$ ./cpp-tests
MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: mali_drm_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: mali_drm
Ready for GLSL
Ready for OpenGL 2.0
Console: IPV4 server is listening on 0.0.0.0:5678

I tried “es2gears” to test openGLES2, it runs accelerated, here is the output:

gs@orangepizeroplus2:~/cocos2d-x-3.15.1/linux-build/gsbuild1/bin/cpp-tests$ es2gears
EGL_VERSION = 1.4 Linux-r3p0-04rel0
vertex shader info:
fragment shader info:
info:

I tried “glxgears”, no acceleration because no openGL on this board, here is the output:

gs@orangepizeroplus2:~/cocos2d-x-3.15.1/linux-build/gsbuild1/bin/cpp-tests$ glxgears
MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: mali_drm_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: mali_drm

My question: cpp-tests wants to use openGL (like “glxgears”), how to make it use openGLES2 (like “es2gears”)?

I found the problem, when linux is defined, it automatically defines CC_PLATFORM_PC in CCPlatformConfig.h and uses the desktop version CCGLViewImpl-desktop.cpp which needs openGL

We need to modify it to use the “mobile” mode on linux, which uses the openGLES 2.0
The Android version: CCGLViewImp-android.cpp is mobile and works under openGLES 2.0

Anyone interested in taking a contract on upwork to modify the CCGLViewImpl-desktop.cpp to mobile CCGLViewImpl-linuxMobile.cpp following the android example CCGLViewImp-android.cpp?

Do you recommend anyone that can do this? When done, it would be a pleasure to contribute it.

I got same problem with Kinguru, anyone have solution?

Hi, I think he means he tried to compile on Ubuntu OpenGL ES (not Android). It is clear that Cocos has not supported OpenGL ES on Ubuntu.

Correct, I believe this is true.

I tried 18.04 while it was in beta, I’ll update to the production release and try out steps again to ensure accuracy.

Thank @slackmoehrle.
Is it possible for you to share current work? I also need it now, I may help partly to get result quickly?
Thank you.