gluCylinder() public static method

public static gluCylinder ( IntPtr qobj, double baseRadius, double topRadius, double height, int slices, int stacks ) : void
qobj System.IntPtr
baseRadius double
topRadius double
height double
slices int
stacks int
return void
Example #1
0
        protected void DrawThumbFinger(int fingerPart)
        {
            switch (fingerPart)
            {
            case 1:
                GL.glRotated(-45, 0, 0, 1);
                GL.glColor3d(1, 1, 1);
                GLU.gluSphere(objShpere, 0.6, 50, 50);
                GL.glTranslated(0, 0.2, 0);
                GL.glRotated(-90, 1, 0, 0);
                GL.glColor3d(1, 0.8, 0.6);
                GLU.gluCylinder(objFinger, 0.5, 0.5, 1, 50, 50);
                GL.glRotated(90, 1, 0, 0);
                GL.glTranslated(0, 0.8, 0);
                GL.glRotated(45, 0, 0, 1);
                break;

            case 2:
                GL.glRotated(-45, 0, 0, 1);
                GL.glColor3d(1, 1, 1);
                GLU.gluSphere(objShpere, 0.6, 50, 50);
                GL.glTranslated(0, 0.2, 0);
                GL.glRotated(-90, 1, 0, 0);
                GL.glColor3d(1, 0.8, 0.6);
                GLU.gluCylinder(objFinger, 0.5, 0.5, 0.7, 50, 50);
                GL.glRotated(90, 1, 0, 0);
                GL.glTranslated(0, 0.6, 0);
                GL.glColor3d(1, 1, 1);
                GLU.gluSphere(objShpere, 0.5, 50, 50);
                GL.glRotated(45, 0, 0, 1);
                GL.glTranslated(-4.6, -1.8, 0);
                break;
            }
        }
Example #2
0
        public void CreateRobotList()
        {
            GL.glPushMatrix();
            //
            // hierarchical list
            //
            GL.glNewList(ROBOT_LIST, GL.GL_COMPILE);

            // BASE : no rotations!!! Angle will be implemented in the CALL routine
            //                   before call to CreateRobotList()
            GL.glColor3f(0, 0, 0.5f);
            GLU.gluCylinder(obj, 3 * r, 3 * r, r * 1.2, 40, 20);
            GL.glTranslated(0, 0, r * 1.2);
            GLU.gluDisk(obj, 0, 3 * r, 40, 20);
            GL.glColor3f(0, 0, 1);
            GLU.gluSphere(obj, r * 1.2, 20, 20);
            // end base

            // transformations
            GL.glRotatef(SHOULDER_angle, 1, 0, 0);

            // call SHOULDER
            GL.glCallList(SHOULDER_LIST);

            // transformations
            //no need in glTranslated 0, 0, SHOULDER_length
            //it is located properly now !!!
            GL.glRotatef(ARM_angle, 1, 0, 0);

            // call ARM
            GL.glCallList(ARM_LIST);
            GL.glEndList();
            GL.glPopMatrix();
        }
Example #3
0
 public void createStemList()
 {
     GL.glNewList(STEM_LIST + currentTree, GL.GL_COMPILE);
     GL.glPushMatrix();
     GL.glRotatef(-90, 1, 0, 0);
     GLU.gluCylinder(obj, 0.1 * widhtScale, 0.08 * widhtScale, 1, 10, 10);
     GL.glPopMatrix();
     GL.glEndList();
 }
Example #4
0
 public static void glutSolidCone(double conebase, double height, int slices, int stacks)
 {
     QUAD_OBJ_INIT();
     GLU.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL);
     GLU.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH);
     // If we ever changed/used the texture or orientation state
     // of quadObj, we'd need to change it to the defaults here
     // with gluQuadricTexture and/or gluQuadricOrientation.
     GLU.gluCylinder(quadObj, conebase, 0.0, height, slices, stacks);
 }
Example #5
0
        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);
        }
Example #6
0
        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);
        }
Example #7
0
        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);
        }
Example #8
0
        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);
        }
Example #9
0
        void PrepareLists()
        {
            float ARM_length, SHOULDER_length;

            ARM_length      = 2;
            ARM_angle       = -45;
            SHOULDER_length = 2.5f;
            SHOULDER_angle  = 10;
            ROBOT_angle     = 45;
            r = 0.3f;

            ROBOT_LIST    = GL.glGenLists(3);
            ARM_LIST      = ROBOT_LIST + 1;
            SHOULDER_LIST = ROBOT_LIST + 2;

            GL.glPushMatrix();
            GL.glNewList(ARM_LIST, GL.GL_COMPILE);
            //cone
            GL.glColor3f(0.5f, 0, 0);
            GLU.gluCylinder(obj, r, 0, ARM_length, 20, 20);
            GL.glTranslated(0, 0, ARM_length);
            //internal disk
            GL.glColor3f(1, 1, 0);
            GLU.gluDisk(obj, 0, r * 0.5, 20, 20);
            //external disk
            GL.glColor3f(1, 0, 0);
            GLU.gluDisk(obj, r * 0.5, r * 1.5, 20, 20);
            GL.glEndList();
            GL.glPopMatrix();

            GL.glPushMatrix();
            GL.glNewList(SHOULDER_LIST, GL.GL_COMPILE);
            GL.glColor3f(0, 0.5f, 0);
            GLU.gluCylinder(obj, r, r, SHOULDER_length, 20, 20);
            GL.glTranslated(0, 0, SHOULDER_length);
            GL.glColor3f(0, 1, 0);
            GLU.gluSphere(obj, r * 1.2, 20, 20);
            GL.glEndList();
            GL.glPopMatrix();

            CreateRobotList();
        }
Example #10
0
        protected void DrawSingleFinger(int fingerPart, double returnToZero)
        {
            switch (fingerPart)
            {
            case 1:
                GL.glColor3d(1, 1, 1);
                GLU.gluSphere(objShpere, 0.6, 50, 50);
                GL.glTranslated(0, 0.2, 0);
                GL.glRotated(-90, 1, 0, 0);
                GL.glColor3d(1, 0.8, 0.6);
                GLU.gluCylinder(objFinger, 0.5, 0.5, 1, 50, 50);
                GL.glRotated(90, 1, 0, 0);
                GL.glTranslated(0, 0.8, 0);
                break;

            case 2:
                GL.glColor3d(1, 1, 1);
                GLU.gluSphere(objShpere, 0.6, 50, 50);
                GL.glTranslated(0, 0.2, 0);
                GL.glRotated(-90, 1, 0, 0);
                GL.glColor3d(1, 0.8, 0.6);
                GLU.gluCylinder(objFinger, 0.5, 0.5, 0.7, 50, 50);
                GL.glRotated(90, 1, 0, 0);
                GL.glTranslated(0, 0.8, 0);
                break;

            case 3:
                GL.glColor3d(1, 1, 1);
                GLU.gluSphere(objShpere, 0.6, 50, 50);
                GL.glTranslated(0, 0.2, 0);
                GL.glRotated(-90, 1, 0, 0);
                GL.glColor3d(1, 0.8, 0.6);
                GLU.gluCylinder(objFinger, 0.5, 0.5, 0.7, 50, 50);
                GL.glRotated(90, 1, 0, 0);
                GL.glTranslated(0, 0.6, 0);
                GL.glColor3d(1, 1, 1);
                GLU.gluSphere(objShpere, 0.5, 50, 50);
                GL.glTranslated(-returnToZero, -5.1, 0);
                break;
            }
        }
Example #11
0
        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);
        }
Example #12
0
        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();
        }
Example #13
0
        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);
        }
Example #14
0
 public void DrawFrame()
 {
     //draw the Frame of mirror
     radius = 0.18f;
     GL.glPushMatrix();
     GL.glColor3f(0.3f, 0.1f, 0.0f);
     GL.glTranslatef(0, -1, 3);
     GLU.gluSphere(obj, radius, 20, 20);
     GL.glTranslatef(0, 1, -3);
     GL.glTranslatef(0, -1, -3f);
     GLU.gluCylinder(obj, radius, radius, radius * 33, 20, 20);
     GLU.gluSphere(obj, radius, 20, 20);
     GL.glTranslatef(0, -5.9f, 0);
     GLU.gluCylinder(obj, radius, radius, radius * 33, 20, 20);
     GLU.gluSphere(obj, radius, 20, 20);
     GL.glRotatef(-90, 1, 0, 0);
     GLU.gluCylinder(obj, radius, radius, radius * 33, 20, 20);
     GLU.gluSphere(obj, radius, 20, 20);
     GL.glScalef(-1, 1, 1);
     GL.glTranslatef(0, -6, 0);
     GLU.gluCylinder(obj, radius, radius, radius * 33, 20, 20);
     GLU.gluSphere(obj, radius, 20, 20);
     GL.glPopMatrix();
 }
Example #15
0
        public void PrepareShadow()
        {
            radius = 0.18f;

            Robot_SHADOW_LIST    = GL.glGenLists(7);
            ARM_SHADOW_LIST      = Robot_SHADOW_LIST + 1;
            SHOULDER_SHADOW_LIST = Robot_SHADOW_LIST + 2;
            HAND_SHADOW_LIST     = Robot_SHADOW_LIST + 3;
            BODY_SHADOW_LIST     = Robot_SHADOW_LIST + 4;
            HEAD_SHADOW_LIST     = Robot_SHADOW_LIST + 5;
            LEG_UP_SHADOW_LIST   = Robot_SHADOW_LIST + 6;
            LEG_DOWN_SHADOW_LIST = Robot_SHADOW_LIST + 7;

            GL.glPushMatrix();
            GL.glNewList(HEAD_SHADOW_LIST, GL.GL_COMPILE);

            GL.glTranslatef(0, 1, 0);
            //head
            GL.glPushMatrix();
            GL.glTranslatef(0, 1, 0);
            GL.glRotatef(-90, 1, 0, 0);
            GLU.gluSphere(obj, radius * 3.5, 20, 20);
            GL.glRotatef(180, 1, 0, 0);
            GLU.gluCylinder(obj, 3.5 * radius, 3.5 * radius, radius * 2, 20, 20);
            GL.glTranslatef(0, 0, radius * 2);
            GLU.gluCylinder(obj, 3.5 * radius, 0.5, radius * 2, 20, 20);
            GL.glTranslatef(0, 0, radius * 2);
            GLU.gluCylinder(obj, 0.5, 0, radius * 2, 20, 20);
            GL.glPopMatrix();
            GL.glEndList();
            GL.glPopMatrix();

            GL.glPushMatrix();
            GL.glNewList(BODY_SHADOW_LIST, GL.GL_COMPILE);


            //ALL body
            //neck
            GL.glPushMatrix();
            GL.glRotatef(90, 1, 0, 0);
            GL.glTranslatef(0, 0, -2.0f);
            GLU.gluCylinder(obj, 1.5 * radius, 1.5 * radius, bodyLength, 20, 20);
            GL.glPopMatrix();

            ////body up
            GL.glRotatef(90, 1, 0, 0);
            GL.glTranslatef(0, 0, -1.2f);
            GLU.gluCylinder(obj, radius, 6 * radius, bodyLength / 4, 20, 20);
            GL.glTranslatef(0, 0, 1.2f);

            //body midle
            GL.glScalef(1.0f, -1.0f, 1.0f);
            GL.glTranslatef(0, 0, -(bodyLength / 4 + 0.2f));
            GLU.gluCylinder(obj, 6 * radius, 3 * radius, bodyLength / 1.5f, 20, 20);
            GL.glTranslatef(0, 0, (bodyLength / 4 + 0.2f));
            GL.glScalef(1.0f, 1.0f, 1.0f);

            //Tusik
            GLU.gluCylinder(obj, 3 * radius, 3 * radius, bodyLength / 1.5f, 20, 20);

            //body down
            GL.glTranslatef(0, 0, (bodyLength / 1.5f));
            GLU.gluCylinder(obj, 3 * radius, radius, bodyLength / 3.5f, 10, 10);
            GL.glTranslatef(0, 0, -(bodyLength / 1.5f));

            GL.glRotatef(-90, 1, 0, 0);
            GL.glEndList();
            GL.glPopMatrix();
            DrawDynamicShadowHand();

            GL.glPushMatrix();
            GL.glNewList(LEG_UP_SHADOW_LIST, GL.GL_COMPILE);
            //leg_up
            GLU.gluCylinder(obj, 1.5f * radius, 1.5f * radius, legUpLength, 20, 20);
            GL.glTranslated(0, 0, legUpLength);
            GLU.gluSphere(obj, radius * 1.7f, 20, 20);
            GL.glEndList();
            GL.glPopMatrix();


            GL.glPushMatrix();
            GL.glNewList(LEG_DOWN_SHADOW_LIST, GL.GL_COMPILE);
            //leg_down
            GLU.gluCylinder(obj, 1.5f * radius, 1.5f * radius, legDownLength, 20, 20);
            GL.glTranslated(0, 0, legDownLength);
            GLU.gluSphere(obj, 1.7f * radius, 20, 20);
            GL.glEndList();
            GL.glPopMatrix();
        }
Example #16
0
        public void DrawRobot(bool isForShades)
        {
            GL.glPushMatrix();
            if (!isForShades)
            {
                GL.glColor4f(0f, 0f, 0.4f, 1f);
                GL.glEnable(GL.GL_COLOR_MATERIAL);
                GL.glMaterialf(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, 51.2f);
                GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, chrome_ambient);
                GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, chrome_diffuse);
                GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, chrome_specular);
            }

            GL.glTranslated(0, 0, 7.5);

            GL.glRotatef(180, 0, 1, 0);
            GL.glRotatef(-alfa, 0, 0, 1);
            GL.glTranslated(0, 0, updn);
            GL.glRotatef(bodyAngle, 0, 1, 0);
            GL.glPushMatrix();


            //torso
            if (isForShades)
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }

            GLU.gluCylinder(obj, 1.0, 1.0, 4.0, 50, 3);
            GLU.gluDisk(obj, 0, 1, 40, 20);
            GL.glTranslated(0, 0, 4);
            GLU.gluDisk(obj, 0, 1, 40, 20);
            GL.glTranslated(0, 0, -4);
            //head
            GL.glTranslated(0, 0, -r * 3);
            GLU.gluSphere(obj, r * 3, 20, 20);

            GL.glPopMatrix();

            GL.glPushMatrix();
            //right_upper_ARM

            GL.glTranslated(0, 1.3, 0.3);

            GL.glRotatef(right_upper_ARM_yangle, 0, 1, 0);
            GL.glRotatef(right_upper_ARM_xangle, 1, 0, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.4, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);
            //right_lower_ARM
            GL.glTranslated(0, 0, 1.7);
            GL.glRotatef(right_lower_ARM_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.1, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            GL.glPopMatrix();

            GL.glPushMatrix();

            //left_upper_ARM

            GL.glTranslated(0, -1.3, 0.3);
            GL.glRotatef(left_upper_ARM_yangle, 0, 1, 0);
            GL.glRotatef(left_upper_ARM_xangle, 1, 0, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.4, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            //left_lower_ARM

            /////
            GL.glTranslated(0, 0, 1.7);
            GL.glRotatef(left_lower_ARM_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.1, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            GL.glPopMatrix();

            GL.glPushMatrix();

            //left_LEG

            GL.glTranslated(0, -0.7, 4.2);
            GL.glRotatef(right_upper_LEG_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.5, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);
            GL.glTranslated(0, 0, 1.7);

            // right_lower_LEG

            GL.glRotatef(right_lower_LEG_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.1, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            GL.glPopMatrix();

            GL.glPushMatrix();

            //right_LEG

            GL.glTranslated(0, 0.7, 4.2);
            GL.glRotatef(left_upper_LEG_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.5, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);
            GL.glTranslated(0, 0, 1.7);
            //left_lower_LEG
            GL.glRotatef(left_lower_LEG_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.1, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            GL.glPopMatrix();

            GL.glPopMatrix();
        }
Example #17
0
        public void DrawShadowHand(bool side)
        {
            GL.glPushMatrix();
            GL.glTranslated(0, 0, 0.23f);
            GL.glPushMatrix();
            if (side == false)
            {
                GL.glTranslatef(0, 0.6f, 0);
                if (WeaponIndex == 1 || WeaponIndex == 2)
                {
                    GL.glRotatef(ShoulderLeftAngle / 10, 0, 0, 1);
                    GL.glRotatef(WeaponPlace, 0, 0, 1);//hand Move from fire
                }
                else
                {
                    GL.glRotatef(-ShoulderLeftAngle, 0, 0, 1);
                }
                GL.glTranslatef(0, -0.6f, 0);
            }
            else
            {
                GL.glTranslatef(0, 0.6f, 0);
                if (WeaponIndex == 1 || WeaponIndex == 2)
                {
                    GL.glRotatef(-ShoulderRightAngle / 10, 0, 0, 1);
                    GL.glRotatef(WeaponPlace, 0, 0, 1);//hand Move from fire
                }
                else
                {
                    GL.glRotatef(-ShoulderRightAngle, 0, 0, 1);
                }
                GL.glTranslatef(0, -0.6f, 0);
            }

            GL.glTranslatef(0, 0.6f, 0.55f);
            GLU.gluCylinder(obj, radius, radius, radius * 1.2, 40, 20);
            GL.glTranslated(0, 0, radius * 1.2);
            GLU.gluDisk(obj, 0, radius, 40, 20);
            GLU.gluSphere(obj, radius * 1.2, 20, 20);
            GL.glTranslatef(0, -0.6f, -0.55f);

            // build Robot shoulder
            GL.glCallList(SHOULDER_SHADOW_LIST);
            GL.glRotatef(ArmLeftAngle, 1, 0, 0);

            //Move down hand with WeaponIndex
            if (WeaponIndex == 2)
            {
                GL.glRotatef(-WeaponPlace, 0, 1, 0);
                GL.glRotatef(WeaponPlace, 0, 0, 1);
            }

            // build Robot arm
            GL.glCallList(ARM_SHADOW_LIST);
            GL.glPopMatrix();

            if (IsMoving == false) //do not see bullets when walking
            {
                GL.glPushMatrix();
                if (WeaponIndex == 2)
                {
                    GL.glTranslatef(0.2f, 0.2f, 1.4f);
                    GL.glRotatef(-8, 0, 1, 0);
                }
                else//WeaponIndex 1
                {
                    GL.glTranslatef(2.2f, 1.4f, 1.3f);
                    GL.glRotatef(-8, 0, 1, 0);
                }

                GL.glRotatef(90, 0, 1, 0);
                GL.glTranslatef(0, 0, ShootDist);
                if (WeaponIndex == 1)
                {
                    //draw bullet
                    radius = radius * 2.2f;
                    GL.glColor3f(0.0f, 0.0f, 0);
                    GLU.gluCylinder(obj, radius / 4.5f, radius / 4.5f, radius / 2, 40, 20);
                    GLU.gluDisk(obj, 0, radius / 4.5f, 20, 20);
                    GL.glTranslatef(0, 0, radius / 2);
                    GLU.gluCylinder(obj, radius / 4.5f, 0, radius / 4, 40, 20);
                    radius = radius / 2.2f;
                }
                else if (WeaponIndex == 2)
                {
                    //draw bullet
                    GL.glColor3f(0.0f, 0.0f, 0);
                    GLU.gluCylinder(obj, radius / 1.3f, radius / 1.3f, radius * 7, 40, 20);
                    GLU.gluDisk(obj, 0, radius / 1.3f, 20, 20);
                    GL.glTranslatef(0, 0, radius * 7);
                    GLU.gluCylinder(obj, radius / 1.3f, 0, radius * 5, 40, 20);
                }
                GL.glPopMatrix();
            }
            GL.glPopMatrix();
        }
Example #18
0
        void DrawDynamicShadowHand()
        {
            switch (WeaponIndex)
            {
            case 0:
                GL.glPushMatrix();
                GL.glNewList(SHOULDER_SHADOW_LIST, GL.GL_COMPILE);
                //shoulder
                GL.glTranslatef(0, 0.6f, 0);
                GL.glTranslated(0, 0, shoulderLength - 0.55);
                GL.glRotatef(55, 1, 0, 0);
                GLU.gluCylinder(obj, radius, radius, shoulderLength, 20, 20);
                GL.glTranslated(0, 0, shoulderLength);
                GLU.gluSphere(obj, 1.3 * radius, 20, 20);
                GL.glEndList();
                GL.glPopMatrix();

                GL.glPushMatrix();
                GL.glNewList(ARM_SHADOW_LIST, GL.GL_COMPILE);
                //arm
                GL.glRotatef(-30, 1, 0, 0);
                GLU.gluCylinder(obj, radius, radius, armLength, 20, 20);
                GL.glTranslated(0, 0, armLength);
                GLU.gluSphere(obj, radius * 2.2, 20, 20);

                GL.glEndList();
                GL.glPopMatrix();
                break;

            case 1:
                GL.glPushMatrix();
                GL.glNewList(SHOULDER_SHADOW_LIST, GL.GL_COMPILE);
                //shoulder
                GL.glTranslatef(0, 0.6f, 0);
                GL.glTranslated(0, 0, shoulderLength - 0.55);
                GL.glRotatef(65, 0, 1, 0);
                GLU.gluCylinder(obj, radius, radius, shoulderLength, 20, 20);
                GL.glTranslated(0, 0, shoulderLength);
                GLU.gluSphere(obj, 1.3 * radius, 20, 20);
                GL.glEndList();
                GL.glPopMatrix();

                GL.glPushMatrix();
                GL.glNewList(ARM_SHADOW_LIST, GL.GL_COMPILE);
                //arm
                GL.glRotatef(-80, 1, 0, 0);
                GL.glRotatef(20, 0, 1, 0);
                GLU.gluCylinder(obj, radius, radius, armLength, 20, 20);
                GL.glTranslated(0, 0, armLength);
                GLU.gluSphere(obj, radius * 2.2, 20, 20);

                //gun1
                GL.glTranslatef(0, 0.6f, 0);
                GL.glScalef(1.5f, 1.5f, 1.5f);
                gun1.DrawModel(false, 1);
                break;

            case 2:
                GL.glPushMatrix();
                GL.glNewList(SHOULDER_SHADOW_LIST, GL.GL_COMPILE);
                //shoulder
                GL.glTranslatef(0, 0.6f, 0);
                GL.glTranslated(0, 0, shoulderLength - 0.55);
                GL.glRotatef(65, 1, 0, 0);
                GLU.gluCylinder(obj, radius, radius, shoulderLength, 20, 20);
                GL.glTranslated(0, 0, shoulderLength);
                GLU.gluSphere(obj, 1.3 * radius, 20, 20);
                GL.glEndList();
                GL.glPopMatrix();

                GL.glPushMatrix();
                GL.glNewList(ARM_SHADOW_LIST, GL.GL_COMPILE);
                //arm
                GL.glRotatef(-80, 1, 0, 0);
                GL.glRotatef(90, 0, 1, 0);
                GLU.gluCylinder(obj, radius, radius, armLength, 20, 20);
                GL.glTranslated(0, 0, armLength);
                GLU.gluSphere(obj, radius * 2.2, 20, 20);

                //gun2
                GL.glRotatef(-30, 0, 0, 1);
                GL.glTranslatef(0, 0.6f, 0);
                GL.glScalef(1.3f, 1.3f, 1.3f);
                gun2.DrawModel(false, 1);
                break;

            case 3:
                GL.glPushMatrix();
                GL.glNewList(SHOULDER_SHADOW_LIST, GL.GL_COMPILE);
                //shoulder
                GL.glTranslatef(0, 0.6f, 0);
                GL.glTranslated(0, 0, shoulderLength - 0.55);
                GL.glRotatef(55, 1, 0, 0);
                GLU.gluCylinder(obj, radius, radius, shoulderLength, 20, 20);
                GL.glTranslated(0, 0, shoulderLength);
                GLU.gluSphere(obj, 1.3 * radius, 20, 20);
                GL.glEndList();
                GL.glPopMatrix();

                GL.glPushMatrix();
                GL.glNewList(ARM_SHADOW_LIST, GL.GL_COMPILE);
                //arm
                GL.glRotatef(-30, 1, 0, 0);
                GLU.gluCylinder(obj, radius, radius, armLength, 20, 20);
                GL.glTranslated(0, 0, armLength);
                GLU.gluSphere(obj, radius * 2.2, 20, 20);

                //sword
                GL.glScalef(0.3f, 0.3f, 0.3f);
                sword.DrawModel(false, 1);
                GL.glScalef(-0.3f, -0.3f, -0.3f);
                break;
            }
            GL.glEndList();
            GL.glPopMatrix();
        }