Change line width or point size with Shaders in PyOpenGL

27 Views Asked by At

I'm using PyOpenGL with shaders to draw lines and points using glDrawElements(GL_LINES) and glDrawElements(GL_POINTS), but when I draw them, nothing shows up. I'm assuming it's because I haven't set any point size or line width in my shaders, and if it is zero by default, the lines and points are invisible, since they are 0 and 1 dimensional. Here is my line drawing function.

glDrawElements(GL_LINES, len(indices_ac_edges), GL_UNSIGNED_INT, None)

And shaders

vertex_shader = """
#version 330
in vec3 position;
in vec3 color;
out vec3 newColor;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main()
{
    gl_Position = projection * view * model * vec4(position, 1.0);
    newColor = color;
}
"""

# Fragment Shader
fragment_shader = """
#version 330
in vec3 newColor;
out vec4 outColor;

void main()
{
    outColor = vec4(newColor, 1.0);
}
"""

How do I make them visible, and change the line width and point size?

0

There are 0 best solutions below