public virtual void Render() { // Set up material properties from color float[] matAmbient = new float[4]; matAmbient[0] = _color.r; matAmbient[1] = _color.g; matAmbient[2] = _color.b; matAmbient[3] = _color.a; float[] matDiffuse = new float[4]; matDiffuse[0] = _color.r + 0.3f; if (matDiffuse[0] > 1.0f) { matDiffuse[0] = 1.0f; } matDiffuse[1] = _color.g + 0.3f; if (matDiffuse[1] > 1.0f) { matDiffuse[1] = 1.0f; } matDiffuse[2] = _color.b + 0.3f; if (matDiffuse[2] > 1.0f) { matDiffuse[2] = 1.0f; } matDiffuse[3] = _color.a + 0.3f; if (matDiffuse[3] > 1.0f) { matDiffuse[3] = 1.0f; } GL.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, matDiffuse); GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, matAmbient); // Draw mesh GL.glPushMatrix(); { GL.glTranslatef(_location.x, _location.y, _location.z); GL.glRotatef(_orientation.scl * 360.0f / (2.0f * (float)Math.PI), _orientation.i, _orientation.j, _orientation.k); Mesh.render(); } GL.glPopMatrix(); }
public void render() { GL.glMatrixMode(GL.GL_MODELVIEW); GL.glLoadIdentity(); mesh.render(); }