-1

I just wrote this shader and it doesn't compile, I have been searching for hours and even checked validators I can not find what is the compilation error. This is my last resort, can anyone spot anything wrong here?

#version 150 core

uniform sampler2D texture1;

in vec4 pass_Color;
in vec2 pass_TextureCoord;
in vec2 pass_Velocity;

out vec4 out_Color;


void main(void) {
    out_Color = pass_Color;

    vec4 color = texture(texture1, pass_TextureCoord) * pass_Color  ;

    pass_TextureCoord += pass_Velocity;

    for(int i = 1; i < 6; ++i, pass_TextureCoord += pass_Velocity)
    {
      vec4 currentColor = texture(texture1, pass_TextureCoord) * pass_Color  ;
      color += currentColor;
    }

    out_Color = (color / 6.0f);
}
Amit Assaraf
  • 512
  • 11
  • 34
  • What error do you get? – Nicol Bolas Aug 29 '13 at 22:47
  • well, simply it doesn't compile successfully.. – Amit Assaraf Aug 30 '13 at 08:22
  • Um, no. Shaders do not simply "not compile successfully". OpenGL has an extensive API for getting the *error messages* from failed compilations. You need to *use this API*. – Nicol Bolas Aug 30 '13 at 08:47
  • 1
    GLU.gluErrorString(errorValue); gives me invalid operation. Also, GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE evaluates to true on that specific shader. – Amit Assaraf Aug 30 '13 at 18:32
  • 1
    `gluErrorString` is not what I was talking about. GLU isn't even OpenGL; it's a separate library. [I was talking about real shader error handling.](http://www.opengl.org/wiki/GLSL_Object#Error_handling) – Nicol Bolas Aug 30 '13 at 22:45
  • Thank you very much, I retrived the log by using this: GL20.glGetShaderInfoLog(shaderID,GL20.glGetShaderi(shaderID,GL20.GL_INFO_LOG_LENGTH)) and it said that I am trying to asign a value to a varying variable. Basicly I cant change variables that have an (in) prefix to them. – Amit Assaraf Aug 30 '13 at 23:13

1 Answers1

0

I retrived the log by using this:

GL20.glGetShaderInfoLog(shaderID,GL20.glGetShaderi(shaderID,GL20.GL_INFO_LOG_LENGTH)); 

and it said that I am trying to asign a value to a varying variable. Basicly I cant change variables that have an (in) prefix to them.

In this case I was trying to add pass_Velocity to pass_TextureCoord, therefor trying to change the value, which is not allowed.

Amit Assaraf
  • 512
  • 11
  • 34