Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

glGetShaderInfoLog returns empty string (android)

I am modifying the version of the android version of the 2d texture example from OpenGl ES2.0 programming guide to change the fragment shader. this is written in pure Java and doesn't use the NDK.

The vanilla example works just fine on my phone, but when I change the shader code it no longer works. This is because my modified shader doesn't compile (obviously), but I can't find the cause of the problem as glGetShaderInfoLog returns an empty string.

I've done a search on this issue, and apparently, as of Jul 22nd, it was a known issue, but I was wondering what ways there are of getting around it. One post I found said they had written an NDK wrapper for the function, but being new to Android development I don't really know how to do this.

like image 597
Teknogrebo Avatar asked Jan 03 '11 22:01

Teknogrebo


3 Answers

You're suffering from a bug. I worked around by using the old GL ES 2.0 bindings to get a functioning glGetShaderInfoLog. Like this:

import com.badlogic.gdx.backends.android.AndroidGL20;
...
AndroidGL20 gl2 = new AndroidGL20();
Log.e(TAG, gl2.glGetShaderInfoLog(shader));

I still use the standard GLES20 wrapper library for everything else, so this was simple to drop into my codebase. The two wrappers apparently can coexist without any problems.

like image 182
dietr Avatar answered Nov 17 '22 15:11

dietr


Just incase anyone does find this question as they have encountered the same problem, the only way I have found to "get around it" is to compile the shader with another App (such as Rendermonkey). Not ideal, but it got me further in my project!

like image 24
Teknogrebo Avatar answered Nov 17 '22 15:11

Teknogrebo


I had the same problem.

  1. Make sure you have the following in ApplicationManufest.xml:

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

  2. Call this after initializing a GLSurfaceView

glSurfaceView.SetEGLContextClientVersion(2);

like image 1
Jake Avatar answered Nov 17 '22 14:11

Jake