public GLAxes(float axisLength) { fXAxis = new GLSpear(new float3(axisLength, 0, 0), ColorRGBA.Red); fYAxis = new GLSpear(new float3(0, axisLength, 0), ColorRGBA.Green); fZAxis = new GLSpear(new float3(0, 0, axisLength), ColorRGBA.Blue); fSphere = new GLUSphere(0.05f, 15, 15); }
protected override void OnSetContext() { GI.ShadeModel(ShadingModel.Smooth); GI.Features.DepthTest.Enable(); // Definition of material GI.Material(GLFace.Front, MaterialParameter.Diffuse, diffuseMaterial); GI.Material(GLFace.Front, MaterialParameter.Specular, mat_specular); GI.Material(GLFace.Front, MaterialParameter.Shininess, 25.0f); // Lighting GI.Features.Lighting.Light0.Location = light_position; GI.Features.Lighting.Enable(); GI.Features.Lighting.Light0.Enable(); GI.ColorMaterial(GLFace.Front, ColorMaterialParameter.Diffuse); GI.Features.ColorMaterial.Enable(); GI.Buffers.ColorBuffer.Color = ColorRGBA.Invisible; sphere = new GLUSphere(GI, 1, 20, 16); sphere.DrawingStyle = QuadricDrawStyle.Fill; }
protected override void OnSetContext() { if (sphere == null) { sphere = new GLUSphere(GI, 1, 32, 32); sphere.DrawingStyle = QuadricDrawStyle.Fill; } GI.Features.DepthTest.Enable(); gl.glDepthFunc(gl.GL_LESS); GI.Features.Lighting.Enable(); GI.Features.Lighting.Light0.Enable(); GI.Features.Lighting.Light0.Ambient = ambient; GI.Features.Lighting.Light0.Diffuse = diffuse; GI.Features.Lighting.Light0.Location = position; gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); gl.glLightModelfv(gl.GL_LIGHT_MODEL_LOCAL_VIEWER, local_view); GI.Buffers.ColorBuffer.Color = new ColorRGBA(0.0f, 0.1f, 0.1f, 0.0f); }