Shader won't run Even When Copy And Pasting Code From Websites

Started by 8BITDEV, March 03, 2020, 15:11:49

Previous topic - Next topic

8BITDEV

So I was messing with some simple shaders to learn how to use them and when i did so it gave me the error

0(1) : error C0000: syntax error, unexpected $undefined, expecting "::" at token "#"
0(10) : warning C1503: undefined variable "pos"


and it wouldn't run.

I also tried instead of #version 330 precision highp float; and it gave me no error but a black screen.

code vertexShader:
#version 330

in vec3 pos;

varying out vec3 color;

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


code fragmentShader:
#version 330

varying out vec4 outColor;

in vec3 color;

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


I've also read the docs and idk if I'im looking and a old pdf they say the code that wont even run is correct.

so what am i doing wrong here?

edit: 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:
precision highp float;

void main() {
	
	gl_FragColor = gl_Color;
	
}