예제 #1
0
        protected override void Draw(List <GizmoPoint> gizmoData)
        {
            if (gizmoData.Count == 0)
            {
                return;
            }

            if (data.Length < gizmoData.Count * 3)
            {
                Array.Resize(ref data, gizmoData.Count * 3);
            }

            int dataIndex = 0;

            for (int i = 0; i < gizmoData.Count; i++)
            {
                GizmoPoint gizmo = gizmoData[i];
                data[dataIndex++] = gizmo.Point.x;
                data[dataIndex++] = gizmo.Point.y;
                data[dataIndex++] = gizmo.Point.z;
            }

            //VBO config
            Ogl.BindBuffer(BufferTarget.ArrayBuffer, vbo);
            Ogl.BufferData(BufferTarget.ArrayBuffer, sizeof(float) * dataIndex, data, BufferUsageHint.StreamDraw);

            //VAO config
            Ogl.BindVertexArray(vao);
            Ogl.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, sizeof(float) * 3, 0);
            Ogl.EnableVertexAttribArray(0);

            Ogl.DrawArray(PrimitiveType.Points, 0, gizmoData.Count);
        }