Is this a valid shader to draw with GL_LINES?

Hi I’m trying to draw a field of lines and these are my shaders:

vertex shader

#version 330

uniform mat4 uProjectionMatrix;
uniform mat4 uModelviewMatrix;

in vec3 inCoord;

void main()
{
	gl_Position = uProjectionMatrix * uModelviewMatrix * vec4(inCoord, 0);
}

fragment shader

#version 330

out vec4 outFragColor;

void main()
{
	vec4 tex_color;
	tex_color = vec4( 1,1,1,1 );

	outFragColor = tex_color;
}

does this look valid?

outFragColor is bound with glBindFragDataLocation and works with my rectangular (ortho) shaders.

I have checked to see that matrices are set properly. Modelview is the identity, Projection is set with the glm::gtc::matrix_projection::perspective<float>( ); function. These look fine and the uniforms are updated before rendering. But I just get a blank cleared background, no white lines showing up. The vertices are in a field around the origin (from -5 to +5 in the x and z directions, each line being drawn from -1 y to 1 y) so I’m expecting to see vertical lines

Bah I figured it out
“vec4(inCoord, 0);” -> “vec4(inCoord, 1);”

:slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.