public override void glDraw() { GL.glClear(GL.GL_COLOR_BUFFER_BIT); GL.glLoadIdentity(); GLU.gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); drawMovTriangle(); this.Refresh(); }
protected override void OnSizeChanged(System.EventArgs e) { GL.glViewport(0, 0, this.Bounds.Width, this.Bounds.Height); GL.glMatrixMode(GL.GL_PROJECTION); GL.glLoadIdentity(); GL.gluPerspective(50.0f, (float)this.Bounds.Width / (float)this.Bounds.Height, 0.1f, 500.0f); GLU.gluLookAt(3.0, 3.0, 8.0, /* Hier wird der Kamerablickwinkel eingestellt für X, Y, Z */ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); GL.glMatrixMode(GL.GL_MODELVIEW); }
public void applyCamera() { // Set up projection matrix GL.glMatrixMode(GL.GL_PROJECTION); GL.glLoadIdentity(); GLU.gluPerspective(FieldAngle * 360.0f / (2.0f * (float)Math.PI), AspectRatio, NearClip, FarClip); GLU.gluLookAt(px, py, pz, tx, ty, tz, ux, uy, uz); GL.glMatrixMode(GL.GL_MODELVIEW); // Render skybox (assume texture already bound) GL.glLoadIdentity(); skybox.render(); }
public override void glDraw() { GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); GL.glLoadIdentity(); GLU.gluLookAt(x, y, z, x + Math.Cos(t), y + Math.Sin(w), z + Math.Sin(t), 0, 1, 0); GL.glEnable(GL.GL_TEXTURE_2D); GL.glTranslatef(0, 0, 500); cube(); GL.glBindTexture(GL.GL_TEXTURE_2D, this.texture[6]); land(); GL.glDisable(GL.GL_TEXTURE_2D); this.Refresh(); }
public void Draw() { if (m_uint_DC == 0 || m_uint_RC == 0) { return; } GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT); GL.glLoadIdentity(); GL.glTranslated(0, 0, -5); GLU.gluLookAt( LookAtEyeX, LookAtEyeY, LookAtEyeZ, LookAtCenterX, LookAtCenterY, LookAtCenterZ, LookAtUpX, LookAtUpY, LookAtUpZ); checkSticksState(); enableLightning(); drawReflectedScene(); // the world is moving (the helicopter always on 0,0,0), its looks like the helicopter is moving GL.glRotatef(m_yRotate, 0, 1, 0); GL.glTranslatef(m_xTranslate, m_yTranslate, m_zTranslate); m_skyscraper.Draw(); // the skybox always keep the same distance from the helicopter, so it is not affected by translation GL.glTranslatef(-m_xTranslate, -m_yTranslate, -m_zTranslate); m_skyBox.Draw(); // the helicopter is not affected by translation or rotation (first person view) GL.glRotatef(m_yRotate, 0, -1, 0); m_helicopter.Draw(); drawShadows(); GL.glFlush(); WGL.wglSwapBuffers(m_uint_DC); }