-4
\$\begingroup\$

Why isn't this glsl program working ?

#shader vertex
#version 430

layout (location = 0) in vec4 position;
layout (location = 1) in vec3 normal;
layout (location = 2) in vec2 texture_coordinate;
layout (location = 3) in vec4 color;

uniform mat4 phantom_projection_matrix;
uniform mat4 phantom_view_matrix;
uniform mat4 phantom_model_matrix;

out OUT_DATA
{
    vec4 position;
    vec3 normal;
    vec2 texture_coordinate;
    vec4 color; 
} vertex_out;

void main()
{
    gl_Position = phantom_projection_matrix * phantom_view_matrix * phantom_model_matrix * position;

    vertex_out.position             = position;
    vertex_out.normal               = normal;
    vertex_out.texture_coordinate   = texture_coordinate;
    vertex_out.color                = color;    
};

#shader geometry
#version 430

layout (points) in;
layout (points, max_vertices = 1) out;

in IN_DATA
{
    vec4 position;
    vec3 normal;
    vec2 texture_coordinate;
    vec4 color; 
} geometry_in[];

out OUT_DATA
{
    vec4 position;
    vec3 normal;
    vec2 texture_coordinate;
    vec4 color;
} geometry_out;

void main()
{
    gl_Position = gl_in[i].gl_Position;
    EmitVertex();
    EndPrimitive();

    geometry_out.position               = geometry_in[0].position;
    geometry_out.normal                 = geometry_in[0].normal;
    geometry_out.texture_coordinate     = geometry_in[0].texture_coordinate;
    geometry_out.color                  = geometry_in[0].color;
}

#shader fragment
#version 430

layout (location = 0) out vec4 color;

in IN_DATA
{
    vec4 position;
    vec3 normal;
    vec2 texture_coordinate;
    vec4 color; 
} geometry_in;

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

#shader tesselation_control
#shader tesselation_evaluation
\$\endgroup\$

closed as unclear what you're asking by DMGregory, Vaillancourt, Kromster says support Monica, Josh Oct 27 '16 at 16:44

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    \$\begingroup\$ What's the expected and actual result? \$\endgroup\$ – SurvivalMachine Oct 23 '16 at 8:30
1
\$\begingroup\$
gl_Position = gl_in[i].glPosition;

The variable i is not specified anywhere, as you're using points as input it has to be of value 0 or you can just use 0 instead (as the Input array is of size 1).

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.