Reputation: 542
I'm trying to render different primities in the same context. When I Do
OpenGL gl = GlControl.OpenGL;
gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | openGL.GL_DEPTH_BUFFER_BIT);
gl.LoadIdentity();
gl.Begin(OpenGL.GL_LINES);
gl.Color(1.0f, 0.0f, 0.0f);
gl.Vertex(0.0f, 1.0f, 0.0f);
gl.Color(0.0f, 1.0f, 0.0f);
gl.Vertex(-1.0f, -1.0f, 1.0f);
gl.End();
Everything is fine. But when I do
OpenGL gl = GlControl.OpenGL;
gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | openGL.GL_DEPTH_BUFFER_BIT);
gl.LoadIdentity();
gl.Begin(OpenGL.GL_LINES);
gl.Color(1.0f, 0.0f, 0.0f);
gl.Vertex(0.0f, 1.0f, 0.0f);
gl.Color(0.0f, 1.0f, 0.0f);
gl.Vertex(-1.0f, -1.0f, 1.0f);
gl.End();
gl.Begin(OpenGL.GL_POINT);
gl.Color(1.0f, 0, 0);
gl.Vertex(0.0f, 0.0f, 1.0f);
gl.End();
I don't see anything anymore...
Upvotes: 1
Views: 272
Reputation: 22177
GL_POINT
is not allowed as argument to gl.Begin
and should through a GL_INVALID_ENUM
. If you want to draw points, the correct code would be
gl.Begin(OpenGL.GL_POINTS);
^
You should definitely check the return value of glGetError().
Upvotes: 3
Reputation: 162317
The valid tokens for immediate mode glBegin
(which you should not use BTW) does not contain GL_POINT
. You probably meant GL_POINTS
. Using an invalid token causes an OpenGL error which may trip your particular C# bindings.
Upvotes: 4