Was trying to implement rounded points logic according to this answer:
Followed all the steps as given:
glEnable(GL_PROGRAM_POINT_SIZE);
glDrawArrays(GL_POINTS, 0, 3 );
vertex shader:
#version 460
layout (location=0) in vec3 VertexPosition;
layout (location=1) in vec3 VertexColor;
layout (location=0) out vec3 vColor;
void main()
{
vColor = VertexColor;
gl_Position = vec4(VertexPosition,1.0);
gl_PointSize = 2.0;
}
fragment shader:
#version 460
layout (location=0) in vec3 vColor;
layout (location=0) out vec4 FragColor;
vec2 circCoord = 2.0 * gl_PointCoord - 1.0;
void main() {
if(dot(circCoord, circCoord) > 1.0){
discard;
}
FragColor = vec4(vColor, 1.0);
}
but for some reason , nothing is being drawn or every fragment is being discarded. If I remove the discard statement in fragment shader I get a square point. What am I doing wrong?