protected override void DoRender(RenderEventArgs arg) { DateTime now = DateTime.Now; const float speed = 1.0f; { float secondAngle = ((float)now.Second) / 60.0f * 360.0f * speed; this.RotationAngleDegree = secondAngle; OpenGL.LoadIdentity(); this.LegacyTransform(); secondLineWidthSwitch.On(); OpenGL.Begin(OpenGL.GL_LINES); for (int i = 0; i < secondPosition.Count; i++) { vec3 color = secondColor[i]; OpenGL.Color3f(color.x, color.y, color.z); vec3 position = secondPosition[i]; OpenGL.Vertex3f(position.x, position.y, position.z); } OpenGL.End(); secondLineWidthSwitch.Off(); } { float minuteAngle = ((float)(now.Minute * 60 + now.Second)) / (60.0f * 60.0f) * 360.0f * speed; this.RotationAngleDegree = minuteAngle; OpenGL.LoadIdentity(); this.LegacyTransform(); minuteLineWidthSwitch.On(); OpenGL.Begin(OpenGL.GL_LINES); for (int i = 0; i < minutePosition.Count; i++) { vec3 color = minuteColor[i]; OpenGL.Color3f(color.x, color.y, color.z); vec3 position = minutePosition[i]; OpenGL.Vertex3f(position.x, position.y, position.z); } OpenGL.End(); minuteLineWidthSwitch.Off(); } { float hourAngle = ((float)((now.Hour * 60 + now.Minute) * 60 + now.Second)) / (12.0f * 60.0f * 60.0f) * 360.0f * speed; this.RotationAngleDegree = hourAngle; OpenGL.LoadIdentity(); this.LegacyTransform(); hourLineWidthSwitch.On(); OpenGL.Begin(OpenGL.GL_LINES); for (int i = 0; i < hourPosition.Count; i++) { vec3 color = hourColor[i]; OpenGL.Color3f(color.x, color.y, color.z); vec3 position = hourPosition[i]; OpenGL.Vertex3f(position.x, position.y, position.z); } OpenGL.End(); hourLineWidthSwitch.Off(); } }
/// <summary> /// This simulates BoundingVolume's render method. /// </summary> /// <param name="renderMode"></param> private void QuadsDraw(RenderModes renderMode) { OpenGL.Begin(DrawMode.Quads); OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MinPosition.z); // Top Right Of The Quad (Top) OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MinPosition.z); // Top Left Of The Quad (Top) OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MaxPosition.z); // Bottom Left Of The Quad (Top) OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MaxPosition.z); // Bottom Right Of The Quad (Top) OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MaxPosition.z); // Top Right Of The Quad (Bottom) OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MaxPosition.z); // Top Left Of The Quad (Bottom) OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MinPosition.z); // Bottom Left Of The Quad (Bottom) OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MinPosition.z); // Bottom Right Of The Quad (Bottom) OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MaxPosition.z); // Top Right Of The Quad (Front) OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MaxPosition.z); // Top Left Of The Quad (Front) OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MaxPosition.z); // Bottom Left Of The Quad (Front) OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MaxPosition.z); // Bottom Right Of The Quad (Front) OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MinPosition.z); // Top Right Of The Quad (Back) OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MinPosition.z); // Top Left Of The Quad (Back) OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MinPosition.z); // Bottom Left Of The Quad (Back) OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MinPosition.z); // Bottom Right Of The Quad (Back) OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MaxPosition.z); // Top Right Of The Quad (Left) OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MinPosition.z); // Top Left Of The Quad (Left) OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MinPosition.z); // Bottom Left Of The Quad (Left) OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MaxPosition.z); // Bottom Right Of The Quad (Left) OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MinPosition.z); // Top Right Of The Quad (Right) OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MaxPosition.z); // Top Left Of The Quad (Right) OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MaxPosition.z); // Bottom Left Of The Quad (Right) OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MinPosition.z); // Bottom Right Of The Quad (Right) OpenGL.End(); }
protected override void DoRender(RenderEventArgs arg) { OpenGL.LoadIdentity(); OpenGL.Begin(DrawMode.Lines); for (int i = 0; i < markPosition.Count; i++) { vec3 color = markColor[i]; OpenGL.Color3f(color.x, color.y, color.z); vec3 position = markPosition[i]; OpenGL.Vertex3f(position.x, position.y, position.z); } OpenGL.End(); }
protected override void DoRender(RenderEventArgs arg) { OpenGL.LoadIdentity(); circleLineWidthSwitch.On(); OpenGL.Begin(DrawMode.LineLoop); for (int i = 0; i < circlePosition.Count; i++) { vec3 color = circleColor[i]; OpenGL.Color3f(color.x, color.y, color.z); vec3 position = circlePosition[i]; OpenGL.Vertex3f(position.x, position.y, position.z); } OpenGL.End(); circleLineWidthSwitch.Off(); }
/// <summary> /// /// </summary> /// <param name="arg"></param> protected override void DoRender(RenderEventArgs arg) { // Push attributes, disable lighting. OpenGL.PushAttrib(OpenGL.GL_CURRENT_BIT | OpenGL.GL_ENABLE_BIT | OpenGL.GL_LINE_BIT | OpenGL.GL_POLYGON_BIT); OpenGL.Disable(OpenGL.GL_LIGHTING); OpenGL.Disable(OpenGL.GL_TEXTURE_2D); OpenGL.LineWidth(1.0f); OpenGL.Color4f(BoxColor.x, BoxColor.y, BoxColor.z, BoxColor.w); //QuadsDraw(gl); //GL.Color(1.0f, 0, 0); OpenGL.Begin(DrawMode.LineLoop); OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MinPosition.z); OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MinPosition.z); OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MaxPosition.z); OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MaxPosition.z); OpenGL.End(); //GL.Color(0, 1.0f, 0); OpenGL.Begin(DrawMode.LineLoop); OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MinPosition.z); OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MinPosition.z); OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MaxPosition.z); OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MaxPosition.z); OpenGL.End(); //GL.Color(0, 0, 1.0f); OpenGL.Begin(DrawMode.Lines); OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MinPosition.z); OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MinPosition.z); OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MinPosition.z); OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MinPosition.z); OpenGL.Vertex3f(MaxPosition.x, MinPosition.y, MaxPosition.z); OpenGL.Vertex3f(MaxPosition.x, MaxPosition.y, MaxPosition.z); OpenGL.Vertex3f(MinPosition.x, MinPosition.y, MaxPosition.z); OpenGL.Vertex3f(MinPosition.x, MaxPosition.y, MaxPosition.z); OpenGL.End(); OpenGL.PopAttrib(); }