protected override void DoRender(RenderEventArgs arg) { this.ClockRenderer.Render(arg); OpenGL.LoadIdentity(); OpenGL.Rotatef(angle, 0, 1, 0); this.BoxRenderer.Render(arg); angle += 3.0f; }
protected override void DoRender(RenderEventArgs arg) { DateTime now = DateTime.Now; const float speed = 1.0f; OpenGL.LoadIdentity(); float secondAngle = ((float)now.Second) / 60.0f * 360.0f * speed; OpenGL.Rotatef(secondAngle, 0.0f, 0.0f, -1.0f); 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(); OpenGL.LoadIdentity(); float minuteAngle = ((float)(now.Minute * 60 + now.Second)) / (60.0f * 60.0f) * 360.0f * speed; OpenGL.Rotatef(minuteAngle, 0.0f, 0.0f, -1.0f); 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(); OpenGL.LoadIdentity(); float hourAngle = ((float)((now.Hour * 60 + now.Minute) * 60 + now.Second)) / (12.0f * 60.0f * 60.0f) * 360.0f * speed; OpenGL.Rotatef(hourAngle, 0.0f, 0.0f, -1.0f); 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(); }