Hey,
I'm having some troubles getting shaders to compile using the OpenGL ES emulator
"precision mediump float;\n" "attribute vec3 inPosition;\n" "attribute vec2 inTexCoords;\n" "varying vec4 Position;\n" "varying vec2 TexCoords;\n" "uniform mat4 modelMatrix;\n" "uniform mat4 viewMatrix;\n" "uniform mat4 projMatrix;\n" "void main()\n" "{\n" " mat4 MVP = projMatrix * viewMatrix * modelMatrix;\n" " Position = MVP * vec4(inPosition, 1.0);\n" " TexCoords = inTexCoords;\n" " gl_Position = Position;\n" "}\n");
This basic shader compiles if I run it on my actual Android device using GLES, however when using the emulator glGetShaderiv reports that the compilation failed but glGetShaderInfoLog returns an empty log.
Is there anything I can do to try and find out why this is failing? I've attached a table of the values I've extracted from glGetString() for reference.
Thanks!
Hi maddius,
The samples are intended for Linux and are therefore C/C++, although I suspect they build for X11 or fbdev so you might need to modify these to do whatever the cube example shipped in the Windows emulator package does to get a window up. Probably you downloaded the Android GLES SDK which contains a mix of Java and native examples AFAIK.
As for glShaderSource, it expects the string(s) to be passed as const GLchar * const *string, so a pointer to the first element of an array of const pointers to const strings. Passing the string directly shouldn't work in any case, so not sure how you had that working in other environments. It should have been sufficient to pass &src as the string param.
Thanks,
Chris