private void DrawIsland() { float moveSphere = GlobalProperties.islandRadius - GlobalProperties.islandHeight; float rotate = 45.0f; GL.glEnable(GL.GL_CLIP_PLANE0); double[] clipPalane0 = { 0.0, 0.0, 1.0, 0.0 }; GL.glClipPlane(GL.GL_CLIP_PLANE0, clipPalane0); GL.glTranslatef(0.0f, 0.0f, -moveSphere); GL.glEnable(GL.GL_TEXTURE_2D); GL.glColor3f(1.0f, 1.0f, 1.0f); GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[1]); GL.glRotatef(rotate, 1.0f, 1.0f, 0.0f); GLUquadric obj = GLU.gluNewQuadric(); GLU.gluQuadricTexture(obj, 1); GLU.gluSphere(obj, GlobalProperties.islandRadius, 32, 32); GLU.gluDeleteQuadric(obj); GL.glRotatef(-rotate, 1.0f, 1.0f, 0.0f); GL.glDisable(GL.GL_TEXTURE_2D); GL.glTranslatef(0.0f, 0.0f, moveSphere); GL.glDisable(GL.GL_CLIP_PLANE0); }
private void drawHandle(float i_Height) { GLUquadric obj = GLU.gluNewQuadric(); GL.glTranslatef(0.5f, 0.0f + i_Height, 0.5f); GL.glRotatef(-90, 1, 0, 0); GLU.gluCylinder(obj, 0.1, 0.1, 0.5, 16, 16); GL.glTranslatef(-0.5f, -1 * i_Height, -0.5f); GLU.gluDeleteQuadric(obj); }
private void DrawPillar(double baseRadius, double topRadius, double height) { GL.glEnable(GL.GL_TEXTURE_2D); GL.glColor3f(1.0f, 1.0f, 1.0f); GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[2]); GLUquadric obj = GLU.gluNewQuadric(); GLU.gluQuadricTexture(obj, 2); GLU.gluCylinder(obj, baseRadius, topRadius, height, 32, 32); GLU.gluDeleteQuadric(obj); GL.glDisable(GL.GL_TEXTURE_2D); }
private void DrawLightBeam() { float length = GlobalProperties.LightBeamLength; Color c = GlobalProperties.LightBeamColor; GL.glColor4ub(c.R, c.G, c.B, (byte)GlobalProperties.LightBeamIntesity); //GL.glEnable(GL.GL_DEPTH_TEST); //GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_Hint, GL.GL_NICEST); //GL.glShadeModel(GL.GL_SMOOTH); //GL.glEnable(GL.GL_LIGHT0); GLUquadric obj = GLU.gluNewQuadric(); GLU.gluCylinder(obj, 0.05, length * 0.05, length, 32, 32); GLU.gluDeleteQuadric(obj); }
private void DrawBackground() { GL.glDisable(GL.GL_LIGHTING); GL.glEnable(GL.GL_TEXTURE_2D); GL.glColor4f(1.0f, 1.0f, 1.0f, 0.5f); GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[4]); float cor = GlobalProperties.seaSize / 2; GLUquadric obj = GLU.gluNewQuadric(); GLU.gluQuadricTexture(obj, 4); GLU.gluCylinder(obj, cor, cor, cor, 32, 32); GLU.gluDeleteQuadric(obj); GL.glDisable(GL.GL_TEXTURE_2D); GL.glEnable(GL.GL_LIGHTING); }
private void DrawWindow() { float windowRadius = GlobalProperties.windowRadius, wondowHeight = GlobalProperties.windowHeight; GL.glEnable(GL.GL_TEXTURE_2D); GL.glColor3f(1.0f, 1.0f, 1.0f); GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[5]); GLUquadric obj = GLU.gluNewQuadric(); GLU.gluQuadricTexture(obj, 5); GLU.gluCylinder(obj, windowRadius, windowRadius, wondowHeight, 32, 32); GL.glTranslatef(0.0f, 0.0f, wondowHeight); GLU.gluCylinder(obj, windowRadius, 0, wondowHeight * 2 / 3, 32, 32); GL.glTranslatef(0.0f, 0.0f, -wondowHeight / 2); GLU.gluDeleteQuadric(obj); GL.glDisable(GL.GL_TEXTURE_2D); }
private void drawGyroCylinder() { GL.glPushMatrix(); // translate the position to draw the cylinder on the top of the cube float xCylinderOrigin = CubeWidth / 2; float yCylinderOrigin = CubeHeight; float zCylinderOrigin = CubeDepth / 2; GL.glTranslatef(xCylinderOrigin, yCylinderOrigin, zCylinderOrigin); // draw the cylinder int cylinderSegements = 16; GLUquadric GluQuadric; GluQuadric = GLU.gluNewQuadric(); GL.glRotatef(90, -1, 0, 0); // the cylinder height is relative to z axis GLU.gluCylinder(GluQuadric, CylinderRadius, CylinderRadius, CylinderHeight, cylinderSegements, cylinderSegements); GL.glRotatef(90, 1, 0, 0); GLU.gluDeleteQuadric(GluQuadric); // draw cylinder cover GL.glBegin(GL.GL_POLYGON); for (int i = 0; i < cylinderSegements; i++) { float theta = 2.0f * 3.1415926f * i / cylinderSegements; //get the current angle float x = CylinderRadius * (float)Math.Cos(theta); //calculate the x component float y = CylinderRadius * (float)Math.Sin(theta); //calculate the y component GL.glVertex3f(x, CylinderHeight, y); } GL.glEnd(); GL.glPopMatrix(); }
private void DrawDisk(double diskHeight, double diskRadius) { GL.glEnable(GL.GL_TEXTURE_2D); GL.glColor3f(1.0f, 1.0f, 1.0f); GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[3]); GL.glPushMatrix(); GLUquadric obj = GLU.gluNewQuadric(); GLU.gluQuadricTexture(obj, 3); GLU.gluDisk(obj, 0, diskRadius, 60, 20); GLU.gluCylinder(obj, diskRadius, diskRadius, diskHeight, 32, 32); GL.glTranslatef(0.0f, 0.0f, (float)diskHeight); GLU.gluDisk(obj, 0, diskRadius, 60, 20); GL.glPopMatrix(); // GL.glTranslatef(0.0f, 0.0f, -(float)diskHeight); GLU.gluDeleteQuadric(obj); GL.glDisable(GL.GL_TEXTURE_2D); }