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(); 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> /// Render something. /// </summary> /// <param name="arg"></param> protected void DoRender(RenderEventArgs arg) { //this.LegacyMVP(arg); this.PushProjectionViewMatrix(arg); this.PushModelMatrix(); circleLineWidthState.On(); GL.Instance.Begin((uint)DrawMode.LineLoop); for (int i = 0; i < circlePosition.Count; i++) { vec3 color = circleColor[i]; GL.Instance.Color3f(color.x, color.y, color.z); vec3 position = circlePosition[i]; GL.Instance.Vertex3f(position.x, position.y, position.z); } GL.Instance.End(); circleLineWidthState.Off(); this.PopModelMatrix(); this.PopProjectionViewMatrix(); }
/// <summary> /// Render something. /// </summary> /// <param name="arg"></param> protected void DoRender(RenderEventArgs arg) { //this.LegacyMVP(arg); this.PushProjectionViewMatrix(arg); this.PushModelMatrix(); DateTime now = DateTime.Now; const float speed = 1.0f; { float secondAngle = ((float)now.Second) / 60.0f * 360.0f * speed; this.RotationAngle = secondAngle; GL.Instance.LoadIdentity(); this.LegacyTransform(); secondLineWidthState.On(); GL.Instance.Begin(GL.GL_LINES); for (int i = 0; i < secondPosition.Count; i++) { vec3 color = secondColor[i]; GL.Instance.Color3f(color.x, color.y, color.z); vec3 position = secondPosition[i]; GL.Instance.Vertex3f(position.x, position.y, position.z); } GL.Instance.End(); secondLineWidthState.Off(); } { float minuteAngle = ((float)(now.Minute * 60 + now.Second)) / (60.0f * 60.0f) * 360.0f * speed; this.RotationAngle = minuteAngle; GL.Instance.LoadIdentity(); this.LegacyTransform(); minuteLineWidthState.On(); GL.Instance.Begin(GL.GL_LINES); for (int i = 0; i < minutePosition.Count; i++) { vec3 color = minuteColor[i]; GL.Instance.Color3f(color.x, color.y, color.z); vec3 position = minutePosition[i]; GL.Instance.Vertex3f(position.x, position.y, position.z); } GL.Instance.End(); minuteLineWidthState.Off(); } { float hourAngle = ((float)((now.Hour * 60 + now.Minute) * 60 + now.Second)) / (12.0f * 60.0f * 60.0f) * 360.0f * speed; this.RotationAngle = hourAngle; GL.Instance.LoadIdentity(); this.LegacyTransform(); hourLineWidthState.On(); GL.Instance.Begin(GL.GL_LINES); for (int i = 0; i < hourPosition.Count; i++) { vec3 color = hourColor[i]; GL.Instance.Color3f(color.x, color.y, color.z); vec3 position = hourPosition[i]; GL.Instance.Vertex3f(position.x, position.y, position.z); } GL.Instance.End(); hourLineWidthState.Off(); } this.PopModelMatrix(); this.PopProjectionViewMatrix(); }