I'm going through OpenGL 3.3+ tutorial written in C++ and I'm converting my code to C# (using OpenTK). In the tutorial there's a VectorBufferObject using vector<BYTE>
to hold data for buffer. Unfortunately I did not manage to achieve same functionality using List<byte>
, because I was unable to convert Vector3 to byteArray the way it could be used by DrawArrays
function.
But well, I've decided to store List<float>
instead and following the tutorial I store all floats (3 for position + 2 for texture coords for each vertice) in a single List of VectorBufferObject.
Apart from not rendering textures properly (my mistake I believe, not important at the moment really) it should work just fine, BUT - it should render a cube and a pyramid rotating - it does render a triangle and a rectangle. I've checked it with PolygonMode.Line and I can tell that the rectangle is made of more than 2 triangles (it has box-type lines going across, not a single one that should be there when drawn with 2 triangles)). I therefore suspect they are drawn one over another. I can't figure out why really.
Below is source code of relevant classes. Please ask if there is a need for more information.
@EDIT Despite my huge hope of following the tutorial, I'd consider an alternative, not overly complicated alternative to that solution.
RenderingEngine.cs http://pastebin.com/gtnX4ESg
VectorBufferObject.cs http://pastebin.com/veGwybp7
Static_Geometry.cs http://pastebin.com/K1bJ8z8u