2、事例二 : 三角形的几何变换平移(Translate)、旋转(Scale)、缩放(Rotate)
namespace sharpGLTest02 { public partial class Form1 : Form { private int mtype = 3; public Form1() { InitializeComponent(); } //初始化 private void openGLControl1_OpenGLInitialized(object sender, EventArgs e) { } //调整 private void openGLControl1_Resize(object sender, EventArgs e) { } //画图 private void openGLControl1_OpenGLDraw(object sender, PaintEventArgs e) { SharpGL.OpenGL gl = this.openGLControl1.OpenGL; gl.ClearColor(0, 0, 0, 1); //清除深度缓存 gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); switch (mtype) { case 0: translateSample(gl); break; case 1: rotateSample(gl); break;