float rtri = 0;
float rquad = 0;
private void openGLControl1_OpenGLDraw( object sender, PaintEventArgs e)
{
// Get the OpenGL object, just to clean up the code.
SharpGL.OpenGL gl = this.openGLControl1.OpenGL;
gl.Clear(OpenGL.COLOR_BUFFER_BIT | OpenGL.DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
gl.LoadIdentity(); // Reset The View
gl.Translate(-1.5f, 0.0f, -6.0f); // Move Left And Into The Screen
gl.Rotate(rtri,0.0f,1.0f,0.0f); //表示其绕y轴旋转,旋转角度为rtri中所代表的角度
gl.Begin(OpenGL.TRIANGLES); // Start Drawing The Pyramid
gl.Color(1.0f, 0.0f, 0.0f); // Red
gl.Vertex(0.0f, 1.0f, 0.0f); // Top Of Triangle (Front)
gl.Color(0.0f, 1.0f, 0.0f); // Green
gl.Vertex(-1.0f, -1.0f, 0.0f); // Left Of Triangle (Front)
gl.Color(0.0f, 0.0f, 1.0f); // Blue
gl.Vertex(1.0f, -1.0f, 0.0f); // Right Of Triangle (Front)
gl.End(); // Done Drawing The Pyramid
gl.Translate(3f, 0.0f, 0.0f); // Move Right And Into The Screen
gl.Rotate(rquad,1.0f,0.0f,0.0f); //表示其绕x轴旋转,旋转角度为rquad所代表的角度
gl.Begin(OpenGL.QUADS); // Start Drawing The Cube
gl.Color(0.5f, 0.5f, 1.0f); // Set The Color To Green
gl.Vertex(-1.0f, 1.0f, 0.0f); // Top Right Of The Quad (Top)
gl.Vertex(1.0f, 1.0f, 0.0f); // Top Left Of The Quad (Top)
gl.Vertex(1.0f, -1.0f, 0.0f); // Bottom Left Of The Quad (Top)
gl.Vertex(-1.0f, -1.0f, 0.0f); // Bottom Right Of The Quad (Top)
gl.End(); // Done Drawing The Q
gl.Flush();
rtri += 3.0f; // 0.2f; // Increase The Rotation Variable For The Triangle
rquad -= 3.0f; // 0.15f; // Decrease The Rotation Variable For The Quad
}