简体   繁体   中英

OpenGl ES 2.0 – Program not running on Moto G

I've created a small project that is working on Eclipse via an emulator. I've tried to run it on a Moto G but it is not working. EDIT Was reading getError twice so following statement is false - "GLES20.glGetError() is not showing any errors" but logcat is showing the beneath.

W/Adreno-ES20﹕ <core_glUseProgram:1546>: GL_INVALID_OPERATION
W/Adreno-ES20﹕ <core_glGetAttribLocation:639>: GL_INVALID_OPERATION
W/Adreno-ES20﹕ <core_glGetAttribLocation:639>: GL_INVALID_OPERATION

Interestingly using step over debugging the first two of below don't show above problem but final one logs : GL_INVALID_ENUM?

GLES20.glEnable( GLES20.GL_CULL_FACE );
GLES20.glCullFace(GLES20.GL_BACK);
GLES20.glEnable(GLES20.GL_TEXTURE_2D);

Have you got any ideas? I've included below in manifest.

uses-feature android:glEsVersion="0x00020000" android:required="true"

One final point is I'm now running on Android Studio with gradle files rather than Eclipse. This is because the latter updated itself and is no longer working due to dependencies.

Thanks for any help in advance.

Mark

This is indeed not a valid call in ES 2.0:

GLES20.glEnable(GLES20.GL_TEXTURE_2D);

Enabling texturing was necessary in old versions of ES (1.x) and OpenGL that used the fixed pipeline.

With the programmable pipeline, which is the only option in ES 2.0 and later, this does not make sense anymore. If you want to use texturing, you sample textures in your shaders. If you don't want to use texturing, you... do not. There's no need to enable texturing.

You can find the valid arguments for glEnable() on the man page .

Eclipse stopped working and so I tried Android Studio. I'm pretty sure the program was working on Eclipse. I had a check like this reqGlEsVersion >= 0x20000. On Android Studio this was returning 0 and so my EGL context wasn't getting created. Apparently there is a problem with the value of this and what AVD set up you have. Once I commented this out it was ok.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM