glGenLists() private method

private glGenLists ( int range ) : uint
range int
return uint
Beispiel #1
0
 public void PrepareAndDrawShadow()
 {
     CAR_SHADOW_LIST = GL.glGenLists(1);
     CAR_SHADOW      = CAR_SHADOW_LIST + 1;
     GL.glPushMatrix();
     GL.glNewList(CAR_SHADOW, GL.GL_COMPILE);
     GL.glTranslatef(0, -5.5f, 0);
     GL.glScalef(0.1f, 0.1f, 0.1f);
     carModel.DrawModel(false, 1);
     GL.glPopMatrix();
     GL.glEndList();
     GL.glPopMatrix();
 }
Beispiel #2
0
 void PrepareLists()
 {
     CLAW_MACHINE_LIST        = GL.glGenLists(10);
     SHADOW_LIST              = CLAW_MACHINE_LIST + 1;
     TEDDY_BEAR_LIST          = CLAW_MACHINE_LIST + 2;
     TEDDY_BEAR_SHADOW_LIST   = CLAW_MACHINE_LIST + 3;
     SIDE_MACHINE_LIST        = CLAW_MACHINE_LIST + 4;
     SIDE_MACHINE_SHADOW_LIST = CLAW_MACHINE_LIST + 5;
     CLAW_LIST        = CLAW_MACHINE_LIST + 6;
     CLAW_SHADOW_LIST = CLAW_MACHINE_LIST + 7;
     CAR_LIST         = CLAW_MACHINE_LIST + 8;
     CAR_SHADOW_LIST  = CLAW_MACHINE_LIST + 9;
 }
Beispiel #3
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();
        }
Beispiel #4
0
        /*
         *
         * Constructor
         *
         */
        public cOGL(Control pb)
        {
            p      = pb;
            Width  = p.Width;
            Height = p.Height;
            InitializeGL();
            obj = GLU.gluNewQuadric();

            //Display lists declaration
            TREE_LIST = GL.glGenLists(MAX_NUMBER_OF_TREES);
            STEM_LIST = GL.glGenLists(MAX_NUMBER_OF_TREES);
            LEAF_LIST = GL.glGenLists(MAX_NUMBER_OF_TREES);
            //APPLE_LIST= GL.glGenLists(MAX_NUMBER_OF_TREES);
            APPLE_LIST          = GL.glGenLists(1);
            STEM_AND_LEAVS_LIST = GL.glGenLists(MAX_NUMBER_OF_TREES);
            TREE_MAT            = GL.glGenLists(4);
            LEAF_MAT            = TREE_MAT + 1;
            WATER_MAT           = TREE_MAT + 3;
            APPLE_MAT           = TREE_MAT + 2;


            //3 points of ground plane
            ground[0, 0] = 1;
            ground[0, 1] = 0f;
            ground[0, 2] = 0;

            ground[1, 0] = -1;
            ground[1, 1] = 0f;
            ground[1, 2] = 0;

            ground[2, 0] = 0;
            ground[2, 1] = 0f;
            ground[2, 2] = -1;

            //light position

            pos[0] = light_position[0] = ScrollValue[9];
            pos[1] = light_position[1] = ScrollValue[10];
            pos[2] = light_position[2] = ScrollValue[11];
            pos[3] = light_position[3] = 0;

            //light0 default properties
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, light_ambient);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, light_diffuse);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, light_specular);
            GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, light_position);
            GL.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);

            randX = new int[MAX_NUMBER_OF_TREES];
            randZ = new int[MAX_NUMBER_OF_TREES];

            locationX       = new double[MAX_NUMBER_OF_TREES];
            locationZ       = new double[MAX_NUMBER_OF_TREES];
            locationRotateY = new double[MAX_NUMBER_OF_TREES];

            randX[0] = 0;
            randZ[0] = 0;

            //rand position for trees,or default value 0 for tree locations.
            for (int i = 0; i < MAX_NUMBER_OF_TREES; i++)
            {
                randX[i]           = rand.Next(-90, 90);
                randZ[i]           = rand.Next(-90, 90);
                locationX[i]       = 0;
                locationZ[i]       = 0;
                locationRotateY[i] = 0;
            }
        }
Beispiel #5
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();
        }
Beispiel #6
0
        public void PrepareLists()
        {
            handList           = GL.glGenLists(21);
            handBaseList       = handList + 1;
            indexFingerStart   = handList + 2;
            middleFingerStart  = handList + 3;
            ringFingerStart    = handList + 4;
            pinkyFingerStart   = handList + 5;
            thumbFingerStart   = handList + 6;
            indexPhalanxList1  = handList + 7;
            indexPhalanxList2  = handList + 8;
            indexPhalanxList3  = handList + 9;
            middlePhalanxList1 = handList + 10;
            middlePhalanxList2 = handList + 11;
            middlePhalanxList3 = handList + 12;
            ringPhalanxList1   = handList + 13;
            ringPhalanxList2   = handList + 14;
            ringPhalanxList3   = handList + 15;
            pinkyPhalanxList1  = handList + 16;
            pinkyPhalanxList2  = handList + 17;
            pinkyPhalanxList3  = handList + 18;
            thumbPhalanxList1  = handList + 19;
            thumbPhalanxList2  = handList + 20;

            floorMainList      = GL.glGenLists(3);
            floorStartPosition = floorMainList + 1;
            floorList          = floorMainList + 2;

            //Floor Start Position
            GL.glPushMatrix();
            GL.glNewList(floorStartPosition, GL.GL_COMPILE);
            GL.glTranslated(0, 0, 0);
            GL.glEndList();
            GL.glPopMatrix();

            //Floor
            GL.glPushMatrix();
            GL.glNewList(floorList, GL.GL_COMPILE);
            DrawFloor();
            GL.glEndList();
            GL.glPopMatrix();

            //Hand Base
            GL.glPushMatrix();
            GL.glNewList(handBaseList, GL.GL_COMPILE);
            DrawHand();
            GL.glEndList();
            GL.glPopMatrix();

            //Index Finger Start Position
            GL.glPushMatrix();
            GL.glNewList(indexFingerStart, GL.GL_COMPILE);
            GL.glTranslated(2.5, 2.3, 0);
            GL.glEndList();
            GL.glPopMatrix();

            //Middle Finger Start Position
            GL.glPushMatrix();
            GL.glNewList(middleFingerStart, GL.GL_COMPILE);
            GL.glTranslated(0.9, 2.3, 0);
            GL.glEndList();
            GL.glPopMatrix();

            //Ring Finger Start Position
            GL.glPushMatrix();
            GL.glNewList(ringFingerStart, GL.GL_COMPILE);
            GL.glTranslated(-0.7, 2.3, 0);
            GL.glEndList();
            GL.glPopMatrix();

            //Pinky Finger Start Position
            GL.glPushMatrix();
            GL.glNewList(pinkyFingerStart, GL.GL_COMPILE);
            GL.glTranslated(-2.5, 2.3, 0);
            GL.glEndList();
            GL.glPopMatrix();

            //Thumb Finger Start Position
            GL.glPushMatrix();
            GL.glNewList(thumbFingerStart, GL.GL_COMPILE);
            GL.glTranslated(3.35, 0.6, 0);
            GL.glEndList();
            GL.glPopMatrix();

            //[1/3] - Index Finger
            GL.glPushMatrix();
            GL.glNewList(indexPhalanxList1, GL.GL_COMPILE);
            DrawSingleFinger(1, 0);
            GL.glEndList();
            GL.glPopMatrix();
            //[2/3]
            GL.glPushMatrix();
            GL.glNewList(indexPhalanxList2, GL.GL_COMPILE);
            DrawSingleFinger(2, 0);
            GL.glEndList();
            GL.glPopMatrix();
            //[3/3]
            GL.glPushMatrix();
            GL.glNewList(indexPhalanxList3, GL.GL_COMPILE);
            DrawSingleFinger(3, 2.5);
            GL.glEndList();
            GL.glPopMatrix();

            //[1/3] - Middle Finger
            GL.glPushMatrix();
            GL.glNewList(middlePhalanxList1, GL.GL_COMPILE);
            DrawSingleFinger(1, 0);
            GL.glEndList();
            GL.glPopMatrix();
            //[2/3]
            GL.glPushMatrix();
            GL.glNewList(middlePhalanxList2, GL.GL_COMPILE);
            DrawSingleFinger(2, 0);
            GL.glEndList();
            GL.glPopMatrix();
            //[3/3]
            GL.glPushMatrix();
            GL.glNewList(middlePhalanxList3, GL.GL_COMPILE);
            DrawSingleFinger(3, 0.9);
            GL.glEndList();
            GL.glPopMatrix();

            //[1/3] - Ring Finger
            GL.glPushMatrix();
            GL.glNewList(ringPhalanxList1, GL.GL_COMPILE);
            DrawSingleFinger(1, 0);
            GL.glEndList();
            GL.glPopMatrix();
            //[2/3]
            GL.glPushMatrix();
            GL.glNewList(ringPhalanxList2, GL.GL_COMPILE);
            DrawSingleFinger(2, 0);
            GL.glEndList();
            GL.glPopMatrix();
            //[3/3]
            GL.glPushMatrix();
            GL.glNewList(ringPhalanxList3, GL.GL_COMPILE);
            DrawSingleFinger(3, -0.7);
            GL.glEndList();
            GL.glPopMatrix();

            //[1/3] - Pinky Finger
            GL.glPushMatrix();
            GL.glNewList(pinkyPhalanxList1, GL.GL_COMPILE);
            DrawSingleFinger(1, 0);
            GL.glEndList();
            GL.glPopMatrix();
            //[2/3]
            GL.glPushMatrix();
            GL.glNewList(pinkyPhalanxList2, GL.GL_COMPILE);
            DrawSingleFinger(2, 0);
            GL.glEndList();
            GL.glPopMatrix();
            //[3/3]
            GL.glPushMatrix();
            GL.glNewList(pinkyPhalanxList3, GL.GL_COMPILE);
            DrawSingleFinger(3, -2.5);
            GL.glEndList();
            GL.glPopMatrix();

            //[1/2] - Thumb Finger
            GL.glPushMatrix();
            GL.glNewList(thumbPhalanxList1, GL.GL_COMPILE);
            DrawThumbFinger(1);
            GL.glEndList();
            GL.glPopMatrix();
            //[2/2]
            GL.glPushMatrix();
            GL.glNewList(thumbPhalanxList2, GL.GL_COMPILE);
            DrawThumbFinger(2);
            GL.glEndList();
            GL.glPopMatrix();


            CreateHandList();
            CreateFloorList();
        }