Skip to main content

My refined and working code goes as follows:

Vertex shader:

#version 330 compatibility

out vData
{
    vec3 normal;
    vec4 color;
}vertex;
 
void main()
{
    vertex.normal = normalize(gl_NormalMatrix * gl_Normal);
    vertex.color = gl_Color;
    gl_Position = ftransform();
}

Geometry shader:

#version 330

layout (points) in;
layout (points) out;
layout (max_vertices = 1) out;
    
in vData
{
    vec3 normal;
    vec4 color;
}vertices[];

out fData
{
    vec3 normal;
    vec4 color;
}frag;    

void main()
{
    int i;
    for(i = 0;i < gl_in.length();i++)
    {
        frag.normal = vertices[i].normal;
        frag.color = vertices[i].color;
        gl_Position = gl_in[i].gl_Position;
        EmitVertex();
    }
    EndPrimitive();
}

Fragment shader:

#version 330 compatibility

in fData
{
    vec3 normal;
    vec4 color;
};frag_in;
  
void main()
{
    gl_FragColor = fragfrag_in.color;
}

Happy coding!

My refined and working code goes as follows:

Vertex shader:

#version 330 compatibility

out vData
{
    vec3 normal;
    vec4 color;
}vertex;
 
void main()
{
    vertex.normal = normalize(gl_NormalMatrix * gl_Normal);
    vertex.color = gl_Color;
    gl_Position = ftransform();
}

Geometry shader:

#version 330

layout (points) in;
layout (points) out;
layout (max_vertices = 1) out;
    
in vData
{
    vec3 normal;
    vec4 color;
}vertices[];

out fData
{
    vec3 normal;
    vec4 color;
}frag;    

void main()
{
    int i;
    for(i = 0;i < gl_in.length();i++)
    {
        frag.normal = vertices[i].normal;
        frag.color = vertices[i].color;
        gl_Position = gl_in[i].gl_Position;
        EmitVertex();
    }
    EndPrimitive();
}

Fragment shader:

#version 330 compatibility

in fData
{
    vec3 normal;
    vec4 color;
};
  
void main()
{
    gl_FragColor = frag.color;
}

Happy coding!

My refined and working code goes as follows:

Vertex shader:

#version 330 compatibility

out vData
{
    vec3 normal;
    vec4 color;
}vertex;
 
void main()
{
    vertex.normal = normalize(gl_NormalMatrix * gl_Normal);
    vertex.color = gl_Color;
    gl_Position = ftransform();
}

Geometry shader:

#version 330

layout (points) in;
layout (points) out;
layout (max_vertices = 1) out;
    
in vData
{
    vec3 normal;
    vec4 color;
}vertices[];

out fData
{
    vec3 normal;
    vec4 color;
}frag;    

void main()
{
    int i;
    for(i = 0;i < gl_in.length();i++)
    {
        frag.normal = vertices[i].normal;
        frag.color = vertices[i].color;
        gl_Position = gl_in[i].gl_Position;
        EmitVertex();
    }
    EndPrimitive();
}

Fragment shader:

#version 330 compatibility

in fData
{
    vec3 normal;
    vec4 color;
}frag_in;
  
void main()
{
    gl_FragColor = frag_in.color;
}

Happy coding!

Source Link

My refined and working code goes as follows:

Vertex shader:

#version 330 compatibility

out vData
{
    vec3 normal;
    vec4 color;
}vertex;
 
void main()
{
    vertex.normal = normalize(gl_NormalMatrix * gl_Normal);
    vertex.color = gl_Color;
    gl_Position = ftransform();
}

Geometry shader:

#version 330

layout (points) in;
layout (points) out;
layout (max_vertices = 1) out;
    
in vData
{
    vec3 normal;
    vec4 color;
}vertices[];

out fData
{
    vec3 normal;
    vec4 color;
}frag;    

void main()
{
    int i;
    for(i = 0;i < gl_in.length();i++)
    {
        frag.normal = vertices[i].normal;
        frag.color = vertices[i].color;
        gl_Position = gl_in[i].gl_Position;
        EmitVertex();
    }
    EndPrimitive();
}

Fragment shader:

#version 330 compatibility

in fData
{
    vec3 normal;
    vec4 color;
};
  
void main()
{
    gl_FragColor = frag.color;
}

Happy coding!