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(); } }
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(); }