void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e) { var arg = new RenderEventArgs(RenderModes.Render, this.camera); mat4 projectionMatrix = camera.GetProjectionMat4(); mat4 viewMatrix = camera.GetViewMat4(); mat4 modelMatrix = mat4.identity(); mat4 mvp = projectionMatrix * viewMatrix * modelMatrix; cylinderElement.mvp = mvp; GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); cylinderElement.Render(arg); //// Load the identity matrix. //GL.LoadIdentity(); //// Rotate around the Y axis. //GL.Rotate(rotation, 0.0f, 1.0f, 0.0f); //// Draw a coloured pyramid. //GL.Begin(GL.GL_TRIANGLES); //GL.Color(1.0f, 0.0f, 0.0f); //GL.Vertex(0.0f, 1.0f, 0.0f); //GL.Color(0.0f, 1.0f, 0.0f); //GL.Vertex(-1.0f, -1.0f, 1.0f); //GL.Color(0.0f, 0.0f, 1.0f); //GL.Vertex(1.0f, -1.0f, 1.0f); //GL.Color(1.0f, 0.0f, 0.0f); //GL.Vertex(0.0f, 1.0f, 0.0f); //GL.Color(0.0f, 0.0f, 1.0f); //GL.Vertex(1.0f, -1.0f, 1.0f); //GL.Color(0.0f, 1.0f, 0.0f); //GL.Vertex(1.0f, -1.0f, -1.0f); //GL.Color(1.0f, 0.0f, 0.0f); //GL.Vertex(0.0f, 1.0f, 0.0f); //GL.Color(0.0f, 1.0f, 0.0f); //GL.Vertex(1.0f, -1.0f, -1.0f); //GL.Color(0.0f, 0.0f, 1.0f); //GL.Vertex(-1.0f, -1.0f, -1.0f); //GL.Color(1.0f, 0.0f, 0.0f); //GL.Vertex(0.0f, 1.0f, 0.0f); //GL.Color(0.0f, 0.0f, 1.0f); //GL.Vertex(-1.0f, -1.0f, -1.0f); //GL.Color(0.0f, 1.0f, 0.0f); //GL.Vertex(-1.0f, -1.0f, 1.0f); //GL.End(); //// Nudge the rotation. //rotation += 3.0f; }
void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e) { // Clear the color and depth buffer. GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); var arg = new RenderEventArgs(RenderModes.Render, this.camera); element.Render(arg); //// Load the identity matrix. //GL.LoadIdentity(); //// Rotate around the Y axis. //GL.Rotate(rotation, 0.0f, 1.0f, 0.0f); //// Draw a coloured pyramid. //GL.Begin(GL.GL_TRIANGLES); //GL.Color(1.0f, 0.0f, 0.0f); //GL.Vertex(0.0f, 1.0f, 0.0f); //GL.Color(0.0f, 1.0f, 0.0f); //GL.Vertex(-1.0f, -1.0f, 1.0f); //GL.Color(0.0f, 0.0f, 1.0f); //GL.Vertex(1.0f, -1.0f, 1.0f); //GL.Color(1.0f, 0.0f, 0.0f); //GL.Vertex(0.0f, 1.0f, 0.0f); //GL.Color(0.0f, 0.0f, 1.0f); //GL.Vertex(1.0f, -1.0f, 1.0f); //GL.Color(0.0f, 1.0f, 0.0f); //GL.Vertex(1.0f, -1.0f, -1.0f); //GL.Color(1.0f, 0.0f, 0.0f); //GL.Vertex(0.0f, 1.0f, 0.0f); //GL.Color(0.0f, 1.0f, 0.0f); //GL.Vertex(1.0f, -1.0f, -1.0f); //GL.Color(0.0f, 0.0f, 1.0f); //GL.Vertex(-1.0f, -1.0f, -1.0f); //GL.Color(1.0f, 0.0f, 0.0f); //GL.Vertex(0.0f, 1.0f, 0.0f); //GL.Color(0.0f, 0.0f, 1.0f); //GL.Vertex(-1.0f, -1.0f, -1.0f); //GL.Color(0.0f, 1.0f, 0.0f); //GL.Vertex(-1.0f, -1.0f, 1.0f); //GL.End(); //// Nudge the rotation. //rotation += 3.0f; }