public void Render(HeaderCommands.PickableObjectRenderType rendertype) { if (rendertype == HeaderCommands.PickableObjectRenderType.Picking) { GL.PushAttrib(AttribMask.AllAttribBits); GL.Disable(EnableCap.Texture2D); GL.Disable(EnableCap.Lighting); if (OpenGLHelpers.Initialization.SupportsFunction("glGenProgramsARB")) { GL.Disable((EnableCap)All.FragmentProgram); } GL.Disable(EnableCap.CullFace); GL.DepthRange(0.0, 0.999); GL.PointSize(50.0f); GL.Color3(PickColor); GL.Begin(PrimitiveType.Points); GL.Vertex3(Position); GL.End(); GL.PopAttrib(); } }
public void Render(HeaderCommands.PickableObjectRenderType rendertype) { if (rendertype == HeaderCommands.PickableObjectRenderType.Picking) { GL.Color3(PickColor); GL.Begin(PrimitiveType.Triangles); foreach (SimpleF3DEX2.Vertex v in Vertices) { GL.Vertex3(v.Position); } GL.End(); } else if (rendertype == HeaderCommands.PickableObjectRenderType.Normal) { GL.PushAttrib(AttribMask.AllAttribBits); GL.Disable(EnableCap.Texture2D); GL.Disable(EnableCap.Lighting); if (Initialization.SupportsFunction("glGenProgramsARB")) { GL.Disable((EnableCap)All.FragmentProgram); } if (Initialization.SupportsFunction("glCreateShader")) { GL.UseProgram(0); } GL.Disable(EnableCap.CullFace); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); GL.DepthRange(0.0, 0.99995); /* White poly */ GL.Color4(1.0, 1.0, 1.0, 0.25); GL.Begin(PrimitiveType.Triangles); foreach (SimpleF3DEX2.Vertex v in Vertices) { GL.Vertex3(v.Position); } GL.End(); /* Black outlines */ GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); GL.LineWidth(2.0f); GL.Color4(Color4.Black); GL.Begin(PrimitiveType.Triangles); foreach (SimpleF3DEX2.Vertex v in Vertices) { GL.Vertex3(v.Position); } GL.End(); /* Vertex points */ GL.DepthRange(0.0, 0.999); GL.PointSize(25.0f); GL.Begin(PrimitiveType.Points); foreach (SimpleF3DEX2.Vertex v in Vertices) { if (SelectedVertex == v) { GL.Color4(Color4.LimeGreen); } else { GL.Color4(Color4.Red); } GL.Vertex3(v.Position); } GL.End(); GL.PopAttrib(); } }