Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failing to compile shader known to be good on android

I have the following shader taken from the android SDK sampele:

   final String vertexShader = 
            "uniform mat4 uMVPMatrix;\n" +
            "attribute vec4 aPosition;\n" +
            "attribute vec2 aTextureCoord;\n" +
            "varying vec2 vTextureCoord;\n" +
            "void main() {\n" +
            "  gl_Position = uMVPMatrix * aPosition;\n" +
            "  vTextureCoord = aTextureCoord;\n" +
            "}\n";

the shader is from their opengl es 2.0 example and works fine when I comile the example.

However when I try to compile the shader in my program I get:

03-07 17:36:21.109: ERROR/GLES20TEST(5992): Could not compile shader 35633:

There is also the fact that the method:

GLES20.glGetShaderInfoLog(shader)

returns no information ( which I belive is a known bug as far as I understood from my google research)

does anyone know what I'm doing wrong?

Thanks, Jason

like image 983
Jason Avatar asked Mar 07 '11 15:03

Jason


1 Answers

Solved the problem.

The problam was that I was trying to create a shader outside of the OnSurfaceCreate causing threading problems

like image 149
Jason Avatar answered Oct 31 '22 01:10

Jason