I want to display filled circles of a dynamically changing radius around a set of points whose 2D coordinates are stored in VBO. So far I have used GL_POINT_SMOOTH, but now, switching to OpenGL 4.0, this option is no longer available. I saw a similar question here , but it doesn’t quite match my need, because the centers of the circles in this example are hardcoded in the fragment shader. How should I do it?
At the moment, my vertex shader looks like this:
#version 400
layout(location=0) in vec2 in_Position;
layout(location=1) in vec4 in_Color;
out vec4 ex_Color;
uniform vec4 bounds;
void main(void){
float x = -1+2/(bounds.y-bounds.x)*(in_Position.x-bounds.x);
float y = -1+2/(bounds.w-bounds.z)*(in_Position.y-bounds.z);
gl_Position = vec4(x,y,0,1);
ex_Color = in_Color;
}
And my fragment shader looks like this:
#version 400
in vec4 ex_Color;
out vec4 out_Color;
void main(void){
out_Color = ex_Color;
}
With these shaders I get square dots.
source
share