i am currently writing a glumpy based renderer in Python.
I am using glumpys OpenGl features for rendering a bunch of points and lines. My points are actually a graph so the lines are edges, multiple edges can have one shared point.
I implemented a picker, which enables me to draw a specific subgraph.
I have a alpha value stored on a buffer for each vertex. When i click, the alpha values are changed, so that only the points of the selected subgraph are drawn with alpha = 1. The shader is called twice:
# Draw Points
self.program_points.draw(gl.GL_POINTS)
# Draw Lines
self.program_points.draw(gl.GL_LINES, self.edge_buffer)
My problem is: The alpha values are set correctly, also the edges with both points alpha = 1 are rendered correctly but the edges that have one point with alpha = 1 and one with alpha = 0 fades out.
I want to don't color the fading edges at all. Is there a way to check on both nodes of an edge and always pick the lower alpha value or something equally useful.
My vertex shader:
uniform vec2 resolution;
attribute vec3 position;
attribute float radius;
attribute float color;
attribute float color_alpha;
attribute float id;
// for AA
varying vec4 v_position;
varying float v_radius;
varying float v_color_alpha;
varying vec4 v_id;
varying float v_color;
void main (void)
{
// this is for the picker!
v_id = vec4 (mod(floor(id / (256*256)), 256) / 255.0,
mod(floor(id / (256)), 256) / 255.0,
mod(floor(id / (1)), 256) / 255.0,
1.0 );
// values to the fragment shader
v_color = color;
v_color_alpha = color_alpha;
v_radius = radius;
//two pixel for AA
gl_PointSize = 2.0+ ceil(2.0*radius);
// hook for the Cameramovement
v_position = <transform(position)>;
gl_Position = v_position;
} ```