protected unsafe override void OnDeviceUpdate(object s, OGLDeviceUpdateArgs e) { var gl = e.gl; // Очищаем буфер экрана и буфер глубины (иначе рисоваться все будет поверх старого) gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT | OpenGL.GL_STENCIL_BUFFER_BIT); gl.Begin(OpenGL.GL_LINE_LOOP); gl.Vertex(-1f, -1f); gl.Vertex(-1f, 1f); gl.Vertex(1f, 1f); gl.Vertex(1f, -1f); gl.End(); spline.Draw(gl); gl.PointSize(VertexSize); lock (locker) { foreach (Vertex2 v in vertices) { if (v == ActiveVertex) { gl.Color(0.0, 1.0, 0.0, 1.0); } else if (v == vertices[0] || v == vertices[vertices.Count - 1]) { gl.Color(0.0, 0.0, 1.0, 1.0); } else { gl.Color(1.0, 0.0, 0.0, 1.0); } gl.Begin(OpenGL.GL_POINTS); gl.Vertex(v.Point.X, v.Point.Y); gl.End(); } } gl.PointSize(1f); gl.Flush(); gl.Color(1.0, 1.0, 1.0, 1.0); return; }
public void Shader(OGLDeviceUpdateArgs e, int offset_vx, int offset_nx, int mode) { unsafe { var gl = e.gl; gl.EnableVertexAttribArray(attrib_loc[0]); gl.EnableVertexAttribArray(attrib_loc[1]); fixed(Vertex *vrt = vertices) { if (mode == 0) { gl.VertexAttribPointer(attrib_loc[0], 3, OpenGL.GL_FLOAT, false, sizeof(Vertex), IntPtr.Add((IntPtr)(vrt), offset_vx)); gl.VertexAttribPointer(attrib_loc[1], 3, OpenGL.GL_FLOAT, false, sizeof(Vertex), IntPtr.Add((IntPtr)(vrt), offset_nx)); } else if (mode == 1) { gl.VertexAttribPointer(attrib_loc[0], 3, OpenGL.GL_FLOAT, false, sizeof(Vertex), new IntPtr(offset_vx)); gl.VertexAttribPointer(attrib_loc[1], 3, OpenGL.GL_FLOAT, false, sizeof(Vertex), new IntPtr(offset_nx)); } } int objectColorLoc = gl.GetUniformLocation(program, "objectColor"); int lightColorLoc = gl.GetUniformLocation(program, "lightColor"); int lightPosLoc = gl.GetUniformLocation(program, "lightPos"); int viewPosLoc = gl.GetUniformLocation(program, "viewPos"); int AmbientPosLoc = gl.GetUniformLocation(program, "ambient"); int DiffusePosLoc = gl.GetUniformLocation(program, "diffuse"); int SpectrPosLoc = gl.GetUniformLocation(program, "spectr"); int PowerLoc = gl.GetUniformLocation(program, "power"); gl.Uniform3(objectColorLoc, (float)ObjectColor.X, (float)ObjectColor.Y, (float)ObjectColor.Z); gl.Uniform3(lightColorLoc, (float)LightColor.X, (float)LightColor.Y, (float)LightColor.Z); gl.Uniform3(viewPosLoc, (float)cameraAngle.X, (float)cameraAngle.Y, (float)cameraAngle.Z); gl.Uniform3(lightPosLoc, (float)LightPosition.X, (float)LightPosition.Y, (float)LightPosition.Z); //gl.Uniform3(viewPosLoc, 0, 0, (float)cameraDistance); /////////// /////////// //////////// //////////// gl.Uniform3(viewPosLoc, (float)LightPosition.X, (float)LightPosition.Y, (float)LightPosition.Z); gl.Uniform3(AmbientPosLoc, (float)Ka.X, (float)Ka.Y, (float)Ka.Z); gl.Uniform3(DiffusePosLoc, (float)Kd.X, (float)Kd.Y, (float)Kd.Z); gl.Uniform3(SpectrPosLoc, (float)Ks.X, (float)Ks.Y, (float)Ks.Z); gl.Uniform1(PowerLoc, SpecularPower); gl.UniformMatrix4((int)uniform_loc[0], 1, false, pMatrix.ToFloatArray(true)); gl.UniformMatrix4((int)uniform_loc[1], 1, false, vMatrix.ToFloatArray(true)); gl.UniformMatrix4((int)uniform_loc[2], 1, false, mMatrix.ToFloatArray(true)); } }
public void Draw_Axes(OGLDeviceUpdateArgs e) { var gl = e.gl; gl.UseProgram(0); #region Axes gl.Color(1f, 0f, 0); gl.Begin(OpenGL.GL_LINES); gl.Vertex(0, 0, 0); gl.Vertex(200, 0, 0); gl.End(); gl.Color(0, 1f, 0); gl.Begin(OpenGL.GL_LINES); gl.Vertex(0, 0, 0); gl.Vertex(0, 200, 0); gl.End(); gl.Color(0f, 0f, 1f); gl.Begin(OpenGL.GL_LINES); gl.Vertex(0, 0, 0); gl.Vertex(0, 0, 200); gl.End(); gl.Color(1f, 1f, 1f); /*for (int i = 0; i < vertices.Count();i++ ) * { * gl.Begin(OpenGL.GL_LINES); * gl.Vertex(0, 0, 0); * gl.Vertex(vertices[i].nx, vertices[i].ny, vertices[i].nz); * gl.End(); * }*/ //gl.PopMatrix(); UpdateModelViewMatrix(); #endregion ; if (UseShader) { gl.UseProgram(program); } }
protected unsafe override void OnDeviceUpdate(object s, OGLDeviceUpdateArgs e) { var gl = e.gl; gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT | OpenGL.GL_STENCIL_BUFFER_BIT); gl.UseProgram(shaderProgram); DMatrix4 modelMat = DMatrix4.Identity; RotateMatrix(ref modelMat, Rotation.X, Rotation.Y, Rotation.Z); ScaleMatrix(ref modelMat, Scale.X, Scale.Y, Scale.Z); double H = gl.RenderContextProvider.Height; double W = gl.RenderContextProvider.Width; double AspectRatio = W / H; DMatrix4 projectionlMat = OrthoNormalized(W, H); DMatrix4 normalMat = DMatrix3.NormalVecTransf(modelMat); LoadGlobalUniforms(gl, shaderProgram); int modelViewMatrixUniformLocation = gl.GetUniformLocation(shaderProgram, "modelViewMatrix"); int projectionMatrixUniformLocation = gl.GetUniformLocation(shaderProgram, "projectionMatrix"); int modelViewNormalMatrixUniformLocation = gl.GetUniformLocation(shaderProgram, "modelViewNormalMatrix"); gl.UniformMatrix4(modelViewMatrixUniformLocation, 1, false, modelMat.ToArray(true).Select(d => (float)d).ToArray()); gl.UniformMatrix4(projectionMatrixUniformLocation, 1, false, projectionlMat.ToArray(true).Select(d => (float)d).ToArray()); gl.UniformMatrix4(modelViewNormalMatrixUniformLocation, 1, false, normalMat.ToArray(true).Select(d => (float)d).ToArray()); #region ендинг сцены методом VBO (Vertex Buffer Object) -------------------------------------------- gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, VertexVBOID); unsafe { fixed(float *ptr = &GLVertecis[0].vx) { gl.BufferData(OpenGL.GL_ARRAY_BUFFER, sizeof(GLVertex) * GLVertecis.Length, new IntPtr(ptr), OpenGL.GL_STATIC_DRAW); } } gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, IndexVBOID); unsafe { fixed(uint *ptr = &indices[0]) { gl.BufferData(OpenGL.GL_ELEMENT_ARRAY_BUFFER, sizeof(uint) * indices.Length, new IntPtr(ptr), OpenGL.GL_STATIC_DRAW); } } gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, VertexVBOID); gl.EnableVertexAttribArray(0); // We like submitting vertices on stream 0 for no special reason gl.VertexAttribPointer(0, 3, OpenGL.GL_FLOAT, false, sizeof(GLVertex), BUFFER_OFFSET(0)); // The starting point of the VBO, for the vertices gl.EnableVertexAttribArray(1); // We like submitting normals on stream 1 for no special reason gl.VertexAttribPointer(1, 3, OpenGL.GL_FLOAT, false, sizeof(GLVertex), BUFFER_OFFSET(12)); // The starting point of normals, 12 bytes away gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, IndexVBOID); gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, OpenGL.GL_UNSIGNED_INT, BUFFER_OFFSET(0)); gl.DisableVertexAttribArray(0); gl.DisableVertexAttribArray(1); gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, 0); gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, 0); #endregion if (Axis) { DrawAxis(gl); } }
protected unsafe override void OnDeviceUpdate(object s, OGLDeviceUpdateArgs e) { var gl = e.gl; UpdateModelViewMatrix(); // Очищаем буфер экрана и буфер глубины (иначе рисоваться все будет поверх старого) gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT | OpenGL.GL_STENCIL_BUFFER_BIT); Count_Aprox(); Count_Vertex(); Create_Vertex(); Count_Polygons(); Create_Polygons(); Draw_Axes(e); int offset_vx = (int)Marshal.OffsetOf(typeof(Vertex), "vx"); int offset_nx = (int)Marshal.OffsetOf(typeof(Vertex), "nx"); int offset_col = (int)Marshal.OffsetOf(typeof(Vertex), "r"); //gl.Rotate(1, 1, 0, 0); gl.Enable(OpenGL.GL_NORMALIZE); // Рендинг сцены реализуется одним из двух методов - VB (Vertex Buffer) или VA (Vertex Array), // в зависимости от выбранного пользователем режима. if (!useVBO) #region ендинг сцены методом VA (Vertex Array) ----------------------------------------------------- { fixed(Vertex *vrt = vertices) { gl.VertexPointer(3, OpenGL.GL_FLOAT, sizeof(Vertex), IntPtr.Add((IntPtr)vrt, offset_vx)); gl.NormalPointer(OpenGL.GL_FLOAT, sizeof(Vertex), IntPtr.Add((IntPtr)vrt, offset_nx)); gl.ColorPointer(3, OpenGL.GL_FLOAT, sizeof(Vertex), IntPtr.Add((IntPtr)vrt, offset_col)); } fixed(int *ptr = indices) { gl.IndexPointer(OpenGL.GL_INT, 0, (IntPtr)(&ptr[0])); } if (UseShader) { Shader(e, offset_vx, offset_nx, 0); } fixed(int *ptr = indices) { gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, (IntPtr)(&ptr[0])); } gl.DisableVertexAttribArray(attrib_loc[0]); gl.DisableVertexAttribArray(attrib_loc[1]); if (Grid) { gl.PolygonMode(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_LINE); } else { gl.PolygonMode(OpenGL.GL_FRONT, OpenGL.GL_FILL); } } #endregion else #region ендинг сцены методом VBO (Vertex Buffer Object) -------------------------------------------- { fixed(uint *ptr = buffers) { gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, ptr[0]); gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, ptr[1]); } ///////////////////// fixed(Vertex *vrt = vertices) { gl.VertexPointer(3, OpenGL.GL_FLOAT, sizeof(Vertex), new IntPtr(offset_vx)); gl.NormalPointer(OpenGL.GL_FLOAT, sizeof(Vertex), new IntPtr(offset_nx)); gl.ColorPointer(3, OpenGL.GL_FLOAT, sizeof(Vertex), new IntPtr(offset_col)); } fixed(Vertex *ptr = vertices) { gl.BufferData(OpenGL.GL_ARRAY_BUFFER, vertices.Length * sizeof(Vertex), IntPtr.Add((IntPtr)ptr, offset_vx), OpenGL.GL_STATIC_DRAW); } fixed(int *ptr = indices) { gl.BufferData(OpenGL.GL_ELEMENT_ARRAY_BUFFER, indices.Length * sizeof(int), (IntPtr)(&ptr[0]), OpenGL.GL_STATIC_DRAW); } if (UseShader) { Shader(e, offset_vx, offset_nx, 1); } fixed(int *ptr = indices) { gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, OpenGL.GL_UNSIGNED_INT, new IntPtr(0 * sizeof(uint))); } gl.DeleteBuffers(2, buffers); gl.DisableVertexAttribArray(attrib_loc[0]); gl.DisableVertexAttribArray(attrib_loc[1]); if (Grid) { gl.PolygonMode(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_LINE); } else { gl.PolygonMode(OpenGL.GL_FRONT, OpenGL.GL_FILL); } } #endregion }
protected unsafe override void OnDeviceUpdate(object s, OGLDeviceUpdateArgs e) { var gl = e.gl; // Очищаем буфер экрана и буфер глубины (иначе рисоваться все будет поверх старого) gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT | OpenGL.GL_STENCIL_BUFFER_BIT); // Рендинг сцены реализуется одним из двух методов - VB (Vertex Buffer) или VA (Vertex Array), // в зависимости от выбранного пользователем режима. if (!useVBO) #region ендинг сцены методом VA (Vertex Array) ----------------------------------------------------- { gl.EnableClientState(OpenGL.GL_VERTEX_ARRAY); gl.EnableClientState(OpenGL.GL_NORMAL_ARRAY); gl.EnableClientState(OpenGL.GL_COLOR_ARRAY); unsafe { fixed(float *ptr = &GLVertecis[0].vx) { float *vptr = ptr + 0; gl.VertexPointer(3, sizeof(GLVertex), vptr); float *nptr = ptr + 3; gl.NormalPointer(sizeof(GLVertex), nptr); float *cptr = ptr + 6; gl.ColorPointer(3, sizeof(GLVertex), cptr); } } if (Wireframe) { gl.DisableClientState(OpenGL.GL_COLOR_ARRAY); gl.PolygonMode(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_LINE); if (Color) { gl.Color((ObjectColor.X + 0.5) % 1.0, (ObjectColor.Y + 0.5) % 1.0, (ObjectColor.Z + 0.5) % 1.0); gl.LineWidth(4f); } else { gl.Color(ObjectColor.X, ObjectColor.Y, ObjectColor.Z); gl.LineWidth(2f); } gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, indices); gl.EnableClientState(OpenGL.GL_COLOR_ARRAY); gl.LineWidth(1f); } if (Color) { gl.PolygonMode(OpenGL.GL_FRONT, OpenGL.GL_FILL); gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, indices); } gl.DisableClientState(OpenGL.GL_VERTEX_ARRAY); gl.DisableClientState(OpenGL.GL_NORMAL_ARRAY); gl.DisableClientState(OpenGL.GL_COLOR_ARRAY); } #endregion else #region ендинг сцены методом VBO (Vertex Buffer Object) -------------------------------------------- { gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, VertexVBOID); unsafe { fixed(float *ptr = &GLVertecis[0].vx) { gl.BufferData(OpenGL.GL_ARRAY_BUFFER, sizeof(GLVertex) * GLVertecis.Length, new IntPtr(ptr), OpenGL.GL_STATIC_DRAW); } } gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, IndexVBOID); unsafe { fixed(uint *ptr = &indices[0]) { gl.BufferData(OpenGL.GL_ELEMENT_ARRAY_BUFFER, sizeof(uint) * indices.Length, new IntPtr(ptr), OpenGL.GL_STATIC_DRAW); } } gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, VertexVBOID); gl.EnableClientState(OpenGL.GL_VERTEX_ARRAY); gl.VertexPointer(3, OpenGL.GL_FLOAT, sizeof(GLVertex), BUFFER_OFFSET(0)); // The starting point of the VBO, for the vertices gl.EnableClientState(OpenGL.GL_NORMAL_ARRAY); gl.NormalPointer(OpenGL.GL_FLOAT, sizeof(GLVertex), BUFFER_OFFSET(12)); // The starting point of normals, 12 bytes away gl.EnableClientState(OpenGL.GL_COLOR_ARRAY); gl.ColorPointer(3, OpenGL.GL_FLOAT, sizeof(GLVertex), BUFFER_OFFSET(24)); // The starting point of colors, 24 bytes away gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, IndexVBOID); if (Wireframe) { gl.DisableClientState(OpenGL.GL_COLOR_ARRAY); gl.PolygonMode(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_LINE); if (Color) { gl.Color((ObjectColor.X + 0.5) % 1.0, (ObjectColor.Y + 0.5) % 1.0, (ObjectColor.Z + 0.5) % 1.0); gl.LineWidth(4f); } else { gl.Color(ObjectColor.X, ObjectColor.Y, ObjectColor.Z); gl.LineWidth(2f); } gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, OpenGL.GL_UNSIGNED_INT, BUFFER_OFFSET(0)); gl.EnableClientState(OpenGL.GL_COLOR_ARRAY); gl.LineWidth(1f); } if (Color) { gl.PolygonMode(OpenGL.GL_FRONT_AND_BACK, OpenGL.GL_FILL); gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, OpenGL.GL_UNSIGNED_INT, BUFFER_OFFSET(0)); } gl.DisableClientState(OpenGL.GL_VERTEX_ARRAY); gl.DisableClientState(OpenGL.GL_NORMAL_ARRAY); gl.DisableClientState(OpenGL.GL_COLOR_ARRAY); gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, 0); gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, 0); } #endregion if (Axis) { DrawAxis(gl); } }
protected unsafe override void OnDeviceUpdate(object s, OGLDeviceUpdateArgs e) { var gl = e.gl; // Очищаем буфер экрана и буфер глубины (иначе рисоваться все будет поверх старого) gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT | OpenGL.GL_STENCIL_BUFFER_BIT); gl.UseProgram(shaderProgram); //Console.WriteLine(gl.GetErrorDescription(gl.GetError())); DMatrix4 modelMat = DMatrix4.Identity; RotateMatrix(ref modelMat, Rotation.X, Rotation.Y, Rotation.Z); ScaleMatrix(ref modelMat, Scale.X, Scale.Y, Scale.Z); double H = gl.RenderContextProvider.Height; double W = gl.RenderContextProvider.Width; double AspectRatio = W / H; DMatrix4 projectionlMat = OrthoNormalized(W, H); DMatrix4 normalMat = DMatrix3.NormalVecTransf(modelMat); LoadGlobalUniforms(gl, shaderProgram); int modelViewMatrixUniformLocation = gl.GetUniformLocation(shaderProgram, "modelViewMatrix"); int projectionMatrixUniformLocation = gl.GetUniformLocation(shaderProgram, "projectionMatrix"); int modelViewNormalMatrixUniformLocation = gl.GetUniformLocation(shaderProgram, "modelViewNormalMatrix"); gl.UniformMatrix4(modelViewMatrixUniformLocation, 1, false, modelMat.ToArray(true).Select(d => (float)d).ToArray()); gl.UniformMatrix4(projectionMatrixUniformLocation, 1, false, projectionlMat.ToArray(true).Select(d => (float)d).ToArray()); gl.UniformMatrix4(modelViewNormalMatrixUniformLocation, 1, false, normalMat.ToArray(true).Select(d => (float)d).ToArray()); // Рендинг сцены реализуется одним из двух методов - VB (Vertex Buffer) или VA (Vertex Array), // в зависимости от выбранного пользователем режима. #region ендинг сцены методом VBO (Vertex Buffer Object) -------------------------------------------- gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, VertexVBOID); unsafe { fixed(float *ptr = &GLVertecis[0].vx) { gl.BufferData(OpenGL.GL_ARRAY_BUFFER, sizeof(GLVertex) * GLVertecis.Length, new IntPtr(ptr), OpenGL.GL_STATIC_DRAW); } } gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, IndexVBOID); unsafe { fixed(uint *ptr = &indices[0]) { gl.BufferData(OpenGL.GL_ELEMENT_ARRAY_BUFFER, sizeof(uint) * indices.Length, new IntPtr(ptr), OpenGL.GL_STATIC_DRAW); } } gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, VertexVBOID); gl.EnableVertexAttribArray(0); // We like submitting vertices on stream 0 for no special reason gl.VertexAttribPointer(0, 3, OpenGL.GL_FLOAT, false, sizeof(GLVertex), BUFFER_OFFSET(0)); // The starting point of the VBO, for the vertices gl.EnableVertexAttribArray(1); // We like submitting normals on stream 1 for no special reason gl.VertexAttribPointer(1, 3, OpenGL.GL_FLOAT, false, sizeof(GLVertex), BUFFER_OFFSET(12)); // The starting point of normals, 12 bytes away gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, IndexVBOID); gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, OpenGL.GL_UNSIGNED_INT, BUFFER_OFFSET(0)); gl.DisableVertexAttribArray(0); gl.DisableVertexAttribArray(1); gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, 0); gl.BindBuffer(OpenGL.GL_ELEMENT_ARRAY_BUFFER, 0); /* общий код удаления буфферов */ #endregion if (Axis) { DrawAxis(gl); } }
protected unsafe override void OnDeviceUpdate(object s, OGLDeviceUpdateArgs e) { var gl = e.gl; // Очищаем буфер экрана и буфер глубины (иначе рисоваться все будет поверх старого) gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT | OpenGL.GL_STENCIL_BUFFER_BIT); float[] modelMat = new float[16]; gl.GetFloat(OpenGL.GL_MODELVIEW_MATRIX, modelMat); float[] projectionMat = new float[16]; gl.GetFloat(OpenGL.GL_PROJECTION_MATRIX, projectionMat); DMatrix4 mM = new DMatrix4(modelMat.Select(val => (double)val).ToArray()); DMatrix4 pM = new DMatrix4(projectionMat.Select(val => (double)val).ToArray()); mM.Transpose(); pM.Transpose(); transformationMatrix = pM * mM; if (Wireframe || Border) { DVector3 b0Color = new DVector3(1.0, 0.0, 0.0); DVector3 b1Color = new DVector3(0.0, 1.0, 0.0); DVector3 b2Color = new DVector3(0.0, 0.0, 1.0); DVector3 b3Color = new DVector3(1.0, 1.0, 0.0); if (Border) { surface.border0.Draw(gl, b0Color); surface.border1.Draw(gl, b1Color); surface.border2.Draw(gl, b2Color); surface.border3.Draw(gl, b3Color); } if (Wireframe) { surface.border0.DrawWireframe(gl, b0Color); surface.border1.DrawWireframe(gl, b1Color); surface.border2.DrawWireframe(gl, b2Color); surface.border3.DrawWireframe(gl, b3Color); } } gl.Color(1.0, 1.0, 1.0, 1.0); surface.DrawByLines(gl); if (Axis) { DrawAxis(gl); gl.DrawText(20, 20, 1.0f, 0.0f, 0.0f, "Arial", 16, "X"); gl.DrawText(35, 20, 0.0f, 1.0f, 0.0f, "Arial", 16, "Y"); gl.DrawText(50, 20, 0.0f, 0.0f, 1.0f, "Arial", 16, "Z"); } lock (ActiveVertexLocker) { if (ActiveVertex != null) { gl.Color(1.0, 0.0, 1.0, 1.0); gl.PointSize(15f); gl.Begin(OpenGL.GL_POINTS); gl.Vertex(ActiveVertex.Point.X, ActiveVertex.Point.Y, ActiveVertex.Point.Z); gl.End(); gl.Color(1.0, 1.0, 1.0, 1.0); gl.PointSize(1f); } } return; }