I thought that everything outside of [-1.0f, +1.0f]
should not be renderable in Open GL. However, this code renders just fine with Silk.NET. I draw 3 axes and one of them is longer than the others.
private static readonly float[] AxisPoints =
{
// X
-2.0f, 0.0f, 0.0f,
2.0f, 0.0f, 0.0f,
// Y
0.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f,
// Z
0.0f, 0.0f, -1.0f,
0.0f, 0.0f, 1.0f
};
private static readonly uint[] Indices =
{
0, 1,
2, 3,
4, 5
};
var numberOfLines = AxisPoints.Length / 3 / 2;
gl.VertexAttributePointer(0, numberOfLines, VertexAttribPointerType.Float, 3, 0);
gl.DrawElements(GLEnum.Lines, Indices.Length, DrawElementsType.UnsignedInt, 0);
Fragment shader
#version 330 core
out vec4 FragColor;
void main()
{
FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);
}
Vertex shader
#version 330 core
layout (location = 0) in vec3 Position;
uniform mat4 Model;
uniform mat4 View;
uniform mat4 Projection;
void main()
{
gl_Position = Projection * View * Model * vec4(Position, 1.0);
}
Question
What is the minimum and maximum value that I can specify for a vertex?
-1..1
(NDC)) or amount of Viewport pixels inwidth / height
depending how you look at it. What is the practical reason for the question though? \$\endgroup\$