
Triangles and Quads...
Posted Sunday, 21 November, 2010 - 10:24 by Iluvatar inHi I have a little Problem with a render-Call.
I try to render Quads (one Quad, to be precise)!
Using this Code:
///Bind the Vertex-Array GL.BindVertexArray(m_vertexArrayObject); ///Draw the Geometry GL.DrawArrays(BeginMode.Quads, 0, 4); ///Check for Errors if (GL.GetError() != ErrorCode.NoError) { Logger.SendToLog("An Error occured while rendering the GroundPlane", LogType.Errors); } ///Unbind the Vertex-Array again GL.BindVertexArray(0);
I get the Message posted! But with a slightly modified Version of the Code here:
///Bind the Vertex-Array GL.BindVertexArray(m_vertexArrayObject); ///Draw the Geometry GL.DrawArrays(BeginMode.Triangles, 0, 3); ///Check for Errors if (GL.GetError() != ErrorCode.NoError) { Logger.SendToLog("An Error occured while rendering the GroundPlane", LogType.Errors); } ///Unbind the Vertex-Array again GL.BindVertexArray(0);
Everything works fine! (Except that I only see one Triangle instead of the Quad....)
Does anybody know what the reason could be?
I can't figure it out :(
My Vertex-Array (and VertexBuffers) should work....
Best regards
Ilu


Comments
Re: Triangles and Quads...
I tried different modes now, this works well:
Or did I mis-interpret the Quads-Mode?
Best regards
Ilu
Re: Triangles and Quads...
Try printing the return value of GL.GetError(), it will give a hint at what might be wrong.
Re: Triangles and Quads...
I tried it, and I get an "Invalid Enum"...
The Error is caused by the GL.DrawArrays call, because I put a GetError() before the Call and everything is fine there....
Thanks for your reply :)
Re: Triangles and Quads...
Are you using a forward-compatible 3.0+ context? BeginMode.Quads is not supported there.
Re: Triangles and Quads...
Ouch, yes, that's true ;)
Must have missed that it's not allowed :(....
Thank's for the Info!