public void draw_sphere(OpenGL gl, double agent) { Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere(); sphere.Radius = agent; GLColor glClr = new GLColor(0.0f, 0.0f, 1.0f, 0.5f); OpenGLAttributesEffect glEffect = new OpenGLAttributesEffect(); glEffect.ColorBufferAttributes.ColorModeClearColor = glClr; glEffect.ColorBufferAttributes.ColorModeWriteMask = glClr; sphere.NormalGeneration = SharpGL.SceneGraph.Quadrics.Normals.Smooth; sphere.NormalOrientation = SharpGL.SceneGraph.Quadrics.Orientation.Outside; sphere.QuadricDrawStyle = SharpGL.SceneGraph.Quadrics.DrawStyle.Fill; sphere.AddEffect(glEffect); sphere.CreateInContext(gl); sphere.Slices = 100; sphere.Stacks = 100; sphere.TextureCoords = false; sphere.PushObjectSpace(gl); sphere.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render); sphere.PopObjectSpace(gl); }
public static GLColor ColorToGLColor(Color c) { GLColor col = new GLColor(); col.ColorNET = c; return col; }
/// <summary> /// Set the current color. /// </summary> /// <param name="gl">The OpenGL instance.</param> /// <param name="color">The color.</param> public static void Color(this OpenGL gl, GLColor color) { gl.Color(color.R, color.G, color.B, color.A); }
private static bool GLColorsEqual(GLColor x, GLColor y) { return x.A.Equals(y.A) && x.B.Equals(y.B) && x.G.Equals(y.G) && x.R.Equals(y.R) && ColorsEqual(x.ColorNET, y.ColorNET); }