gluNewQuadric() private method

private gluNewQuadric ( ) : void*
return void*
        public void draw_moon()
        {
            GL.glPushMatrix();

            GL.glColor3d(1, 1, 1);
            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[1]);


            quad = GLU.gluNewQuadric();
            GLU.gluQuadricTexture(quad, 40);


            GL.glTranslatef(-200, 200, -300);

            // rotating moon as well as all planets to Y axis
            GL.glTranslatef(0.0f + (float)speed * 0.01f, 0.0f, 0.0f);
            GL.glTranslatef(0.0f, 0.0f + (float)speed * 0.01f, 0.0f);

            GL.glRotatef((float)moon++ *0.5f, 1.0f, 1.0f, 0.0f);


            GLU.gluSphere(quad, 18, 200, 200);

            GL.glPopMatrix();
        }
示例#2
0
        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);
        }
        public void draw_sun()
        {
            GL.glPushMatrix();
            GL.glColor3d(1, 1, 1);

            GL.glEnable(GL.GL_TEXTURE_2D);
            GL.glBindTexture(GL.GL_TEXTURE_2D, Textures[6]);


            quad = GLU.gluNewQuadric();
            GLU.gluQuadricTexture(quad, 40);

            GL.glTranslatef(pos[0], pos[1], pos[2]);

            // rotating sun as well as all planets to Y axis
            GL.glTranslatef(0.0f, 0.0f + (float)-speed * 0.03f, 0.0f);  //y - up down
            GL.glTranslatef(0.0f, 0.0f, 0.0f + (float)-speed * 0.01f);  //z - back forward

            GL.glRotatef((float)moon, 0.0f, 1.0f, 0.0f);

            GLU.gluSphere(quad, 45, 1000, 1000);



            GL.glPopMatrix();


            moon += 0.04f;
        }
示例#4
0
        public cOGL(Control pb)
        {
            p      = pb;
            Width  = p.Width;
            Height = p.Height;
            InitializeGL();
            obj = GLU.gluNewQuadric(); //!!!
            //3D model b1
            ch        = new Character("ninja.ms3d");
            ch1       = new Character("ninja.ms3d");
            isAnimate = false;
            isInside  = false;
            isBounds  = false;
            viewAngle = 45;
            Xangl     = 0;
            Yangl     = 0;
            Zangl     = 0;

            intOptionA = 1;

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

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

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


            isSolid = true;
        }
示例#5
0
 public Robot(uint texture)
 {
     this.headTexture = texture;
     gun1             = new Milkshape.Character("mauser_red9.ms3d");
     gun2             = new Milkshape.Character("hk-mp7.ms3d");
     sword            = new Milkshape.Character("katana.ms3d");
     obj = GLU.gluNewQuadric(); //!!!
 }
示例#6
0
文件: cOGL.cs 项目: matanmaron/Tanks
 public cOGL(Control pb)
 {
     p      = pb;
     Width  = p.Width;
     Height = p.Height;
     InitializeGL();
     Bullet.bulletsize = 0.06f;
     obj = GLU.gluNewQuadric(); //!!!
 }
示例#7
0
 public cOGL(Control pb)
 {
     p      = pb;
     Width  = p.Width;
     Height = p.Height;
     InitializeGL();
     obj = GLU.gluNewQuadric(); //!!!
     PrepareLists();
 }
示例#8
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);
        }
示例#9
0
 public cOGL(Control pb)
 {
     network.Hide();
     p      = pb;
     Width  = p.Width;
     Height = p.Height;
     InitializeGL();
     Bullet.bulletsize = 0.06f;
     tank.RandomPosition(worldsize);
     obj        = GLU.gluNewQuadric(); //!!!
     fullscreen = true;
 }
示例#10
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);
        }
示例#11
0
        public cOGL(Control pb)
        {
            p      = pb;
            Width  = p.Width;
            Height = p.Height;
            obj    = GLU.gluNewQuadric();

            InitializeGL();

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

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

            ground[2, 0] = 0;
            ground[2, 1] = 0;
            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;


            light_position_reflected[0] = -ScrollValue[9];
            light_position_reflected[1] = -ScrollValue[10];
            light_position_reflected[2] = -ScrollValue[11];
            light_position_reflected[3] = 0;


            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.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, light_ambient);
            GL.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, light_diffuse);
            GL.glLightfv(GL.GL_LIGHT1, GL.GL_SPECULAR, light_specular);
            GL.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, light_position_reflected);
            GL.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
        }
示例#12
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);
        }
示例#13
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);
        }
示例#14
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);
        }
示例#15
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();
        }
示例#16
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);
        }
示例#17
0
        public cOGL(Control pb)
        {
            p      = pb;
            Width  = p.Width;
            Height = p.Height;


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

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

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

            pos[0] = -4;
            pos[1] = -4;
            pos[2] = 15;
            pos[3] = 1;


            Random rnd = new Random();

            for (int i = 0; i < 20; i++)
            {
                arr[i].setX(rnd.Next(-50, 50));
                arr[i].setY(rnd.Next(-50, 50));
                arr[i].toDraw = true;
            }


            InitializeGL();
            obj = GLU.gluNewQuadric(); //!!!
        }
示例#18
0
        public cOGL(Control pb)
        {
            p         = pb;
            Width     = p.Width;
            Height    = p.Height;
            objFinger = GLU.gluNewQuadric();
            objShpere = GLU.gluNewQuadric();

            InitializeGL();
            PrepareLists();

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

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

            ground[2, 0] = 1;
            ground[2, 1] = 0;
            ground[2, 2] = -0.5f;
        }
示例#19
0
        public cOGL(Control pb)
        {
            m_DisplayPanel = pb;
            InitializeGL();
            obj = GLU.gluNewQuadric(); //!!!

            PrepareLists();
            teddyBear             = new TeddyBear(TEDDY_BEAR_LIST, TEDDY_BEAR_SHADOW_LIST, 7, "toy.obj");
            toyCar                = new ToyCar(CAR_LIST, CAR_SHADOW_LIST, 2, "car.obj");
            claw                  = new Claw(obj, CLAW_LIST, CLAW_SHADOW_LIST);
            ClawMachine           = new ClawMachine(obj, CLAW_MACHINE_LIST, SHADOW_LIST, teddyBear, claw);
            MainLightSource       = new LightSource(0, 0, 0);
            StaticRedLightSource  = new LightSource(10, 8, 10);
            StaticBlueLightSource = new LightSource(-10, 8, -10);
            m_SideMachine         = new SideMachine(SIDE_MACHINE_LIST, SIDE_MACHINE_SHADOW_LIST);
            mainShadowManager     = new ShadowUtills(MainLightSource);
            redShadowManager      = new ShadowUtills(StaticRedLightSource);
            blueShadowManager     = new ShadowUtills(StaticBlueLightSource);
            ground[0, 0]          = 1;
            ground[0, 1]          = -3f;
            ground[0, 2]          = 0f;

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

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

            //----------banner light position-----------
            bannerLightPos[0]    = 0;
            bannerLightPos[1]    = 5.9f;
            bannerLightPos[2]    = 2.7f;
            bannerLightPos[3]    = 1f;
            bannerLightDirection = "RIGHT";
        }
示例#20
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;
            }
        }
示例#21
0
 /// <summary>
 /// Initializes a new quadric.
 /// </summary>
 private static void InitQuadObj()
 {
     quadObj = GLU.gluNewQuadric();
 }
示例#22
0
 public Mirror()
 {
     obj = GLU.gluNewQuadric(); //!!!
 }