Skip to main content
Bumped by Community user
Bumped by Community user
added 2 characters in body
Source Link
nialna2
  • 930
  • 1
  • 8
  • 19

I am programming in Haxe (enginelanguage 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;
}

I am programming in Haxe (engine 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;
}

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;
}
Source Link
nialna2
  • 930
  • 1
  • 8
  • 19

Fragment shader compiling in webGL but not in OpenGL

I am programming in Haxe (engine 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;
}