Esempio n. 1
0
        public void PrepareAndDraw()
        {
            CAR_LIST = GL.glGenLists(1);
            CAR      = CAR_LIST + 1;
            GL.glPushMatrix();
            GL.glNewList(CAR, GL.GL_COMPILE);
            GL.glTranslatef(0, -5.5f, 0);
            GL.glScalef(0.1f, 0.1f, 0.1f);

            carModel.DrawModel(true, 1);
            GL.glPopMatrix();
            GL.glEndList();
            GL.glPopMatrix();
        }
Esempio n. 2
0
        void DrawDynamicHand()
        {
            switch (WeaponIndex)
            {
            case 0:
                GL.glPushMatrix();
                GL.glNewList(SHOULDER_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_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_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_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(true, 1);
                break;

            case 2:
                GL.glPushMatrix();
                GL.glNewList(SHOULDER_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_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(true, 1);
                break;

            case 3:
                GL.glPushMatrix();
                GL.glNewList(SHOULDER_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_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(true, 1);
                GL.glScalef(-0.3f, -0.3f, -0.3f);
                break;
            }
            GL.glEndList();
            GL.glPopMatrix();
        }