Hello,
I'm drawing points with this code:
GL.Color3(Color.DarkViolet);
GL.PointSize(2.0f);
GL.Begin(BeginMode.Points);
foreach (Coord pt in this.pts)
{
GL.Vertex3(pt.X, pt.Y, pt.Z);
}
Now I want to draw the points with vbo.
But I'm getting lost in the buffers ;-)
Comments
Re: Drawing points
What i have so far is this: (please verify this solution, because I can see the points but I'M not sure that I make everything right)
Re: Drawing points
I believe...
If _points is a Vector3[] then
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(_points.Length * Vector3.SizeInBytes), _points, BufferUsageHint.StaticDraw); //
If _points is a float[] then
GL.DrawArrays(BeginMode.Points, 0, this.pts.Length / 3);
Re: Drawing points
Thank you for your comment.
_pointsis afloat[]andthis.pts.Length == _points.Length / 3Re: Drawing points
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(_points.Length * sizeof(float)), _points, BufferUsageHint.StaticDraw);The second parameter should be the stride of an element, which is the stride of a vertex (3 floats) so use * sizeof(float) * 3 there.
Best to test your code with 1 and 2 points to assure correctness.