Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
so i am new to lwjgl and am i messing with making a 3d game with so i was learning about shaders and i followed the tutorial and i got this error message

0(1) : error C0000: syntax error, unexpected $undefined, expecting "::" at token "#"
0(5) : error C5060: out can't be used with non-varying color
0(10) : warning C1503: undefined variable "pos"


and my code for vertexShader is

#version 150

in vec3 pos;

out vec3 color;

void main(void)
{
	
	gl_Position = vec4(pos, 1.0);
	color = vec3(0.5,0.5,1.0);
	
}


my code for the fragmentShader is

#version 150

out vec4 outColor;

in vec3 color;

void main(void)
{
	outColor = vec4(color,1.0);
}


What I have tried:

i have tried precision highp float;

but it gave me this error

0(1) : warning C7022: unrecognized profile specifier "highp"
0(1) : warning C7022: unrecognized profile specifier "nullprecision"
0(5) : error C5060: out can't be used with non-varying color


am i doing something wrong here?
Posted
Updated 3-Mar-20 7:32am

You need to check the documentation for the correct syntax for your code, and the error messages. As this is a specialised library, you will most likely get a faster response at the LWJGL Forum - Index[^].
 
Share this answer
 
Comments
8BITDEVreal 3-Mar-20 10:02am    
i already have checked the documentation and i will make a post on the lwjgl forum
Richard MacCutchan 3-Mar-20 10:38am    
I could not find a link to the documentation that makes your code clear. And to be honest it does not look like valid Java.
8BITDEVreal 3-Mar-20 11:56am    
its glsl and this tutorial does the same https://www.youtube.com/watch?v=4w7lNF8dnYw&t=2s
i figured it It don't seem to support #version anymore and in and out are also invalid so i found it was just a error with my shader code as i am following a tutorial series a couple years old

my new vertexShader:
precision highp float;

void main() {

gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Color = gl_Position + 0.5;
gl_FrontColor = gl_Color;

}

fragmentShader:
[code]precision highp float;

void main() {

gl_FragColor = gl_Color;

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900