✅ OpenGl Problem : I am trying to render a square, but I am getting a black Screen
I am using C# witch OpenTk. Here is the Code:
4 Replies
Vertex Shader :
#version 330
layout(location = 0) in vec4 aPosition;
void main()
{
gl_Position = aPosition;
}
Fragment Shader :
#version 330
out vec4 FragColor;
void main()
{
FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}
Did the compilation of the shader succeed?
+ the ValidateProgram call
Please let us know what the issue was :>
Oh, Im sorry, i filled the indexbuffer with the vertex data, instead of the index data...
BufferData(OpenTK.Graphics.OpenGL.BufferTarget.ElementArrayBuffer, indicies.Length * sizeof(uint), vertecies, OpenTK.Graphics.OpenGL.BufferUsageHint.StaticDraw);
the "vertecies" varieable is the vertexdata. Copie and pastet without checking twice if i had corrected everything
I tried GL.DrawArray(), wich only uses the Vertecies and it worked. So i knew it hat something to do with the index Buffer
Thanks! ❤️