Shaders not working on mac

I’m working on a game with a Canadian dude in LWJGL and we are having a problem (More like he is because I’m barely doing anything) with shaders. It shows up on windows but not on mac. It’s supposed to be just a green light but we are getting a black screen.

Here’s our (Basically his) code: http://pastebin.com/SGg79gyX

Can you post source code of the shaders?

its at the bottom of the paste bin. Its only a fragment shader.

It might be some problem. Can you try some error checking? You can use this method to check for errors.


public static void checkForErrors(String line)
{
    int error;

    while ((error = GL11.glGetError()) != GL11.GL_NO_ERROR)
    {
        System.err.println(line + ": " + GLU.gluGetErrorString(error));
    }
}

Use this method before and after of every suspected gl call and report the output.

This is what it showed in the console:

Fragment shader not compiled!
No error

Maybe try glGetShaderInfoLog to get error messages?


glCompileShader(fragmentShader)
if (glGetShaderi(fragmentShader, GL_COMPILE_STATUS) == GL_FALSE) {
  log.error("Unable to compile fragment shader")
  log.error(glGetShaderInfoLog(fragmentShader, 1024))
}

We fixed it, I forgot to set what GL version it was using:

#version 120
uniform vec2 lightLocation;
uniform vec3 lightColor;

void main() {
	float distance = length(lightLocation - gl_FragCoord.xy);
	float attenuation = 1.0 / distance;
	vec4 color = vec4(attenuation, attenuation, attenuation, pow(attenuation, 3)) * vec4(lightColor, 1);
	
	gl_FragColor = color;
}