Variable not getting passed. GLSL
Hello I have been trying to get a color variable to my fragment shader. I have tried a few different ways and none have worked...
anyone know what I'm doing wrong?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
static const GLchar* vertShaderSource[] =
{
"#version 430 core \n"
"layout (location = 0) in vec4 offset; \n"
"layout (location = 1) in vec4 color; \n"
"out vec4 vs_color; \n"
"void main(void) \n"
"{ \n"
"const vec4 vertices[3] = vec4[3](vec4(0.25,-0.25,0.5,1.0),vec4(-0.25,-0.25,0.5,1.0),vec4(0.25,0.25,0.5,1.0)); \n"
"gl_Position = vertices[gl_VertexID] + offset; \n"
"vs_color[gl_VertexID]=color; \n"
"} \n"
};
//SOURCE FOR TESSALATION CONTROL SHADER
static const GLchar* TCSsource[] =
{
"#version 430 core \n"
"layout (vertices = 3) out; \n"
"in vec4 vs_color[]; \n"
"out Tess{ \n"
"vec4 tcs_color; \n"
"} Out[]; \n"
"void main(void) \n"
"{ \n"
"if(gl_InvocationID == 0) \n"
"{ \n"
"gl_TessLevelInner[0] = 5.0; \n"
"gl_TessLevelOuter[0] = 5.0; \n"
"gl_TessLevelOuter[1] = 5.0; \n"
"gl_TessLevelOuter[2] = 5.0; \n"
"} \n"
"gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; \n"
"Out[gl_InvocationID].tcs_color = vs_color[gl_InvocationID]; \n"
"} \n"
};
//SOURCE FOR THE TEESALATION CONTROL SHADER
static const GLchar* TEShaderSource[] =
{
"#version 430 core \n"
"layout (triangles,equal_spacing,cw) in; \n"
"in Tess{ \n"
"vec4 tcs_color; \n"
"} In[];"
"out vec4 tes_color; \n"
"void main(void) \n"
"{ \n"
"gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position + gl_TessCoord.y * gl_in[1].gl_Position + gl_TessCoord.z * gl_in[2].gl_Position); \n"
"tes_color = In[0].tcs_color; \n"
"} \n"
};
//SOURCE CODE FOR FRAGMENT SHADER
static const GLchar* fragShaderSource[] =
{
"#version 430 core \n"
" \n"
"in vec4 tes_color; \n"
"out vec4 color; \n"
" \n"
"void main(void) \n"
"{ \n"
"color = tes_color; \n"
"} \n"
};
|
Topic archived. No new replies allowed.