gl2 shader update to gl3
Hi. I'm trying to convert gl2 shader program (gm.illumlines.jxs) to gl3 version.
I have managed to add all checklists that Cycling74 suggest, but still there's an syntax error and blank lines.
what's the equivalent of gl_FrontColorIn[1] and gl_PositionIn[3] for gl3? many tutorials said gl_FrontColor can be replaced by declaring in vec4 color and binds it. I keep getting syntax error.
here's my gl3 vertex shader:
#version 330 core
out vec3 P;
out vec3 T;
in vec4 color;
void main(void)
{
color = color[1];
T = gl_PositionIn[2].xyz - gl_PositionIn[1].xyz;
P = gl_PositionIn[1].xyz;
gl_Position = projectionMat*vec4(gl_Position[1], 1.0);
EmitVertex();
color = color[2];
T = gl_PositionIn[3].xyz - gl_PositionIn[2].xyz;
P = gl_PositionIn[2].xyz;
gl_Position = projectionMat*gl_PositionIn[2];
EmitVertex();
EndPrimitive();
}
and this is original part
#version 120
#extension GL_EXT_geometry_shader4 : enable
varying out vec3 P;
varying out vec3 T;
void main(void)
{
gl_FrontColor = gl_FrontColorIn[1];
T = gl_PositionIn[2].xyz - gl_PositionIn[1].xyz;
P = gl_PositionIn[1].xyz;
gl_Position = gl_ProjectionMatrix*gl_PositionIn[1];
EmitVertex();
gl_FrontColor = gl_FrontColorIn[2];
T = gl_PositionIn[3].xyz - gl_PositionIn[2].xyz;
P = gl_PositionIn[2].xyz;
gl_Position = gl_ProjectionMatrix*gl_PositionIn[2];
EmitVertex();
EndPrimitive();
}