private void Form1_Load(object sender, EventArgs e) { Glut.glutInit(); Glut.glutInitDisplayMode(Glut.GLUT_RGB | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH); Gl.glClearColor(255, 255, 255, 1); Gl.glViewport(0, 0, simpleOpenGlControl1.Width, simpleOpenGlControl1.Height); Gl.glMatrixMode(Gl.GL_PROJECTION); Gl.glLoadIdentity(); Glu.gluPerspective(45, (double)simpleOpenGlControl1.Width / (double)simpleOpenGlControl1.Height, 0.1, 200); Gl.glMatrixMode(Gl.GL_MODELVIEW); Gl.glLoadIdentity(); Gl.glEnable(Gl.GL_DEPTH_TEST); Gl.glEnable(Gl.GL_LIGHTING); Gl.glEnable(Gl.GL_LIGHT0); Il.ilInit(); Il.ilEnable(Il.IL_ORIGIN_SET); }
private void timer2_Tick(object sender, EventArgs e) { if (isLoaded) { Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); Gl.glClearColor(0, 0, 0, 1); Gl.glLoadIdentity(); Gl.glEnable(Gl.GL_TEXTURE_2D); Gl.glBindTexture(Gl.GL_TEXTURE_2D, indexObject); Gl.glPushMatrix(); Gl.glTranslated(0, -1, -15); Gl.glRotated(t, 1, 0, 0); Gl.glRotated(t1, 0, 1, 0); Glu.GLUquadric quadro = Glu.gluNewQuadric(); Glu.gluQuadricTexture(quadro, Gl.GL_TRUE); Gl.glEnable(Gl.GL_TEXTURE_2D); //Glu.gluSphere(quadro, 0.3, 50, 50); Glut.glutSolidTeapot(2); Gl.glDisable(Gl.GL_TEXTURE_2D); Gl.glPopMatrix(); Gl.glDisable(Gl.GL_TEXTURE_2D); simpleOpenGlControl1.Invalidate(); } }