简体   繁体   中英

GLSL strange compilation errors

I have searched on the web but cannot find the reason why it is doing this. I have my vertex and fragment shaders here:

// Vertex Shader
#version 150 core

in vec3 position;

out vec3 color;

void main(void) {

gl_Position = vec4(position.x, position,y, position.z, 1.0);

color = vec3(position.x + 1.0, position,y + 1.0, position.z + 1.0);

}

And:

//Fragment Shader
#version 150 core

in vec3 color;

out vec4 finalColor;

void main(void) {

finalColor = vec4(1.0, 0.0, 0.0, 1.0);

}

I looked over it several times and while it serves no real purpose as a shader it still doesn't have any visible errors in the code. Whe I try to compile it I get the following error:

ERROR: 0:5: 'y' : undeclared identifier

ERROR: 0:5: 'constructor' : too many arguments

ERROR: 0:6: 'constructor' : too many arguments Strange enough I get the error on either the vertex or fragment shader depending on which one I plug into glCompileShader() first. I have tried swapping version numbers but it didn't work and I no longer feel like programming today >.>

position , y lol. You have a comma instead of a period. it should be position**.**y.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM