I am programming in Haxe
(language compiling to multiple platforms) and I have written some shaders.
My fragment shader runs fine in html5, but when I try to compile for native (OS X and/or Neko, a VM for Haxe) I get a shader compilation error, but no details (I am using lime
which is a platform abstraction that does these things for me).
Here is the shader:
precision mediump float;
varying vec4 v_color;
void main() {
gl_FragColor = v_color;
}
Very simple as you can see. It runs fine in webGL, but it seems it won't compile in OpenGL. I am no expert in shaders so I have no idea what might be wrong. Am I using some syntax that only exists in webGL?
Also just in case, here is my vertex shader (which compiles fine):
attribute vec3 a_position;
attribute vec4 a_color;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
varying vec4 v_color;
void main() {
gl_Position = uMVMatrix * vec4(a_position, 1);
v_color = a_color;
}
precision mediump float;
part, and now the shader compiles. I don't understand, isn't that supposed to work in OpenGL too? \$\endgroup\$