Beispiel #1
0
        public override void Render()
        {
            Gl.glPushMatrix();

            Gl.glRotatef(-90, 1.0f, 0.0f, 0.0f);

            Gl.glPushMatrix();

            Gl.glPushMatrix();
            Cor(0.647059f, 0.164706f, 0.164706f);
            Gl.glTranslatef(0, 0, -.1f);
            Glut.glutSolidCube(0.1f);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Cor(0.647059f, 0.164706f, 0.164706f);
            Gl.glTranslatef(0, 0, 0);
            Glut.glutSolidCube(0.1f);
            Gl.glPopMatrix();

            Cor(0.678431f, 1, 0.184314f);
            Glut.glutSolidCone(0.2f, 0.5, 10, 10);
            Gl.glPopMatrix();
            Gl.glPopMatrix();
        }
Beispiel #2
0
        /// <summary>
        ///     Draws the scene.
        /// </summary>
        private static void Render()
        {
            Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, light0Position);

            Gl.glPushMatrix();
            Gl.glColor3f(0.4f, 1.0f, 0.4f);
            Gl.glTranslatef(0.0f, 0.0f, 2.5f);
            Glut.glutSolidSphere(0.5, 12, 12);

            Gl.glTranslatef(0.5f, 0.0f, -0.7f);
            Gl.glColor3f(1.0f, 0.4f, 0.4f);
            Glut.glutSolidCube(0.3);

            Gl.glTranslatef(-0.5f, 0.0f, -0.2f);
            Gl.glRotatef(-90, 1.0f, 0.0f, 0.0f);
            Gl.glColor3f(1.0f, 1.0f, 0.4f);
            Glut.glutSolidCone(0.3, 0.6, 8, 8);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslatef(0.2f, 0.3f, -2.0f);
            Gl.glColor3f(0.9f, 0.4f, 0.9f);
            Glut.glutWireTorus(0.3f, 0.8f, 8, 8);
            Gl.glPopMatrix();
        }
Beispiel #3
0
 private void degree(double wid, double height)
 {
     Gl.glPushMatrix();
     Gl.glScaled(0.15, wid, height);
     Glut.glutSolidCube(1);
     Gl.glPopMatrix();
 }
Beispiel #4
0
 protected override void dessine_toi()
 {
     Gl.glPushMatrix();
     Gl.glTranslatef((float)Position_objet_X, (float)Position_objet_Y, 0);
     Glut.glutSolidCube(1.5f);
     Gl.glPopMatrix();
 }
Beispiel #5
0
        private void Clock()
        {
            Gl.glColor3ub(255, 180, 180);

            Gl.glPushMatrix();
            Gl.glScaled(1.0f, 1.0f, 0.7f);
            Glut.glutSolidTorus(1, 9, 32, 32);
            Gl.glPopMatrix();

            Glut.glutSolidCylinder(0.5f, 0.3f, 32, 32);
            Gl.glColor3ub(255, 255, 255);

            Gl.glPushMatrix();
            Gl.glScaled(9.0f, 9.0f, 0.1f);
            Glut.glutSolidSphere(1.0f, 100, 100);
            Gl.glPopMatrix();
            //Glut.glutSolidCylinder(9f, 0.1f, 32, 32);
            for (int i = 0; i < 12; i++)
            {
                Gl.glPushMatrix();

                Gl.glColor3ub(150, 175, 255);
                Gl.glRotated(i * 30.0f, 0, 0, 1);
                Gl.glTranslated(7.5f, 0.0f, 0.1f);
                Gl.glScaled(1.0f, 0.2f, 0.2f);
                Glut.glutSolidCube(1.0f);

                Gl.glPopMatrix();
            }
        }
Beispiel #6
0
 public override void Render()
 {
     Gl.glPushMatrix();
     Gl.glColor3f(0.0f, 1.0f, 0.0f);
     Glut.glutSolidCube(0.5f);
     Gl.glPopMatrix();
 }
Beispiel #7
0
        /// <summary>
        ///     Draws the scene.
        /// </summary>
        private static void Render()
        {
            Gl.glColor3f(0.4f, 1.0f, 0.4f);
            Glut.glutSolidSphere(0.6, 12, 12);

            Gl.glPushMatrix();
            Gl.glTranslatef(0.6f, 0.35f, 0.6f);
            Gl.glColor3f(1.0f, 0.7f, 0.7f);
            Glut.glutSolidCube(0.2);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslatef(0.7f, 0.85f, 0.7f);
            Gl.glRotatef(angle2 += 1, 0.0f, 1.0f, 0.0f);
            Gl.glTranslatef(0.0f, -0.2f, 0.0f);
            Gl.glRotatef(-90, 1.0f, 0.0f, 0.0f);
            Gl.glColor3f(1.0f, 1.0f, 0.4f);
            Glut.glutWireCone(0.2, 0.4, 8, 8);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslatef(-0.9f, -0.9f, -0.1f);
            Gl.glRotatef(90, -0.5f, 0.5f, 0.15f);
            Gl.glRotatef(angle2, 0.0f, 0.0f, 1.0f);
            Gl.glColor3f(1.0f, 0.4f, 1.0f);
            Glut.glutWireTorus(0.2, 0.5, 8, 8);
            Gl.glPopMatrix();
        }
Beispiel #8
0
        private void room()
        {
            Gl.glColor3ub(107, 201, 224);
            //ground
            Gl.glPushMatrix();
            Gl.glTranslated(0.5, 0.01, 0.5); //把它移到對齊XY軸  Y是0.01是因為前面把它壓扁後厚度為0.02 所以她的一辦事0.01
            Gl.glScaled(1.0, 0.02, 1.0);     //壓扁這個cube 讓他變成一面牆
            //Glut.glutSolidCube(1);
            MySolidCube(1.0, 100);
            Gl.glPopMatrix();


            Gl.glPushMatrix();
            Gl.glRotated(-90.0, 1, 0, 0); //1把它以X軸旋轉90度變成另一面牆
            Gl.glTranslated(0.5, 0.01, 0.5);
            Gl.glScaled(1.0, 0.02, 1.0);
            Glut.glutSolidCube(1);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glRotated(90.0, 0, 0, 1.0);   //對Z軸旋轉90度
            Gl.glTranslated(0.5, 0.01, 0.5); //把它移到對齊XY軸  Y是0.01是因為前面把它壓扁後厚度為0.02 所以她的一辦事0.01
            Gl.glScaled(1.0, 0.02, 1.0);     //壓扁這個cube 讓他變成一面牆
            Glut.glutSolidCube(1);
            Gl.glPopMatrix();
        }
Beispiel #9
0
 void augshejs_ikshkis(float nobide) //Draw the upper part of the thumb
 {
     Gl.glPushMatrix();
     Gl.glTranslatef(nobide, 0.5f * Augshejo_pirkstu_platums, 0.0f);
     Gl.glScalef(Augshejo_pirkstu_garums, Augshejo_pirkstu_platums, Augshejo_pirkstu_garums);
     Glut.glutSolidCube(1.0);
     Gl.glPopMatrix();
 }
Beispiel #10
0
 void apakshejie_pirksti(float nobide) //Draw the lower parts of the fingertips
 {
     Gl.glPushMatrix();
     Gl.glTranslatef(nobide, 0.5f * Apakshejo_pirkstu_platums, 0.0f);
     Gl.glScalef(Apakshejo_pirkstu_garums, Apakshejo_pirkstu_platums, Apakshejo_pirkstu_garums);
     Glut.glutSolidCube(1.0);
     Gl.glPopMatrix();
 }
Beispiel #11
0
 void Apaksheja_roka() //draw the lower hand
 {
     Gl.glPushMatrix();
     Gl.glTranslatef(0.0f, 0.5f * Apakshejas_rokas_platums, 0.0f);
     Gl.glScalef(Apakshejas_rokas_garums, Apakshejas_rokas_platums, Apakshejas_rokas_garums);
     Glut.glutSolidCube(1.0); //zdraw a filled parallelepiped
     Gl.glPopMatrix();
 }
Beispiel #12
0
 void Augsheja_roka() //draw the upper hand
 {
     Gl.glPushMatrix();
     Gl.glTranslatef(0.0f, 0.5f * Augshejas_rokas_platums, 0.0f);
     Gl.glScalef(Augshejas_rokas_garums, Augshejas_rokas_platums, Augshejas_rokas_garums);
     Glut.glutSolidCube(1.0); //draw a filled parallelogram with radius 1
     Gl.glPopMatrix();
 }
Beispiel #13
0
 static void DesenhaQuadra()
 {
     Gl.glPushMatrix();
     Gl.glColor3f(1.0f, 0.5f, 0.0f);
     Gl.glScalef(15.0f, 0.5f, 28.0f);
     Glut.glutSolidCube(1.0f);
     Gl.glPopMatrix();
 }
Beispiel #14
0
        private void DrawBlock(int x, int z)
        {
            Gl.glPushMatrix();

            Gl.glTranslated(x * sizeBlock, sizeBlock / 2, z * sizeBlock);
            Glut.glutSolidCube(sizeBlock);

            Gl.glPopMatrix();
        }
Beispiel #15
0
 void augshejie_pirksti(float nobide) //draw the upper fingers, "nobide" indicates how much to move along the x-axis,
 //this is necessary so that the fingers can be placed on the x-axis one after the other with spaces
 {
     Gl.glPushMatrix();
     Gl.glTranslatef(nobide, 0.5f * Augshejo_pirkstu_platums, 0.0f);
     Gl.glScalef(Augshejo_pirkstu_garums, Augshejo_pirkstu_platums, Augshejo_pirkstu_garums);
     Glut.glutSolidCube(1.0);
     Gl.glPopMatrix();
 }
Beispiel #16
0
 static void Tabela2()
 {
     Gl.glPushMatrix();
     Gl.glColor3f(0.117f, 0.388f, 0.835f);
     Gl.glScalef(1.8f, 1.05f, 0.5f);
     Gl.glTranslatef(0.0f, -3.0f, 27.0f);
     Glut.glutSolidCube(1.0f);
     Gl.glPopMatrix();
 }
Beispiel #17
0
 static void HasteCesta2()
 {
     Gl.glPushMatrix();
     Gl.glColor3f(0.23f, 0.23f, 0.23f);
     Gl.glScalef(0.5f, 3.0f, 0.5f);
     Gl.glTranslatef(0.0f, -0.5f, -28.0f);
     Glut.glutSolidCube(1.0f);
     Gl.glPopMatrix();
 }
 private int Cube(OpenGL gl, double parameter1, double parameter2)
 {
     CounterCube += 1;
     if (CounterCube >= 100)
     {
         CounterCube = 0;
     }
     gl.Translate(parameter1, 0, parameter2);
     gl.Color((byte)ColorArray1[CounterCube, 0], (byte)ColorArray1[CounterCube, 1], (byte)ColorArray1[CounterCube, 2]);
     Glut.glutSolidCube(0.05);
     return(0);
 }
Beispiel #19
0
 public void Draw()
 {
     Gl.glColor3f(1, 1, 1);
     Gl.glPushMatrix();
     Gl.glTranslatef(Pieza.GlobalPos.X, Pieza.GlobalPos.Y, Pieza.GlobalPos.Z);
     Gl.glTranslatef(position.X, position.Y, position.Z);
     //Gl.glScalef(Pieza.Scale.X, Pieza.Scale.Y, Pieza.Scale.Z);
     Gl.glScalef(0.2f, 1, 1);
     Gl.glTranslatef(0, 0.5f, 0);
     Glut.glutSolidCube(1);
     Gl.glPopMatrix();
 }
Beispiel #20
0
        private void Line(double len, float wid, double angle)
        {
            Gl.glPushMatrix();

            Gl.glColor3ub(20, 20, 20);

            Gl.glRotated(angle, 0, 0, 1);
            Gl.glTranslated(len / 2.0f, 0.0f, 0.4f);
            Gl.glScaled(len, wid, wid);

            Glut.glutSolidCube(1.0f);

            Gl.glPopMatrix();
        }
 public static void DrawPlate3D(double xpos, double ypos, double xang, double yang, double zang, RGBAColor col)
 {
     glColor4d(col.Mix(col, new RGBAColor(0, 0, 0, 1), 0.2));
     Gl.glPushMatrix();
     Gl.glTranslated(xpos, ypos, 0.7);
     Gl.glRotated(xang, 1, 0, 0);
     Gl.glRotated(yang, 0, 1, 0);
     Gl.glRotated(zang, 0, 0, 1);
     Gl.glScaled(0.7, 0.1, 0.7);
     Glut.glutSolidCube(1);
     Gl.glLineWidth(2);
     glColor4d(col);
     Glut.glutWireCube(1);
     Gl.glPopMatrix();
 }
Beispiel #22
0
        private void Leg(float x, float y, float z, int r, int g, int b, int r2, int g2, int b2)
        {
            Gl.glPushMatrix();
            Gl.glTranslated(x, y, z);
            Gl.glColor3ub((byte)r, (byte)g, (byte)b);
            Gl.glPushMatrix();
            Gl.glScaled(0.3f, 0.5f, 0.3f);
            Glut.glutSolidCube(1.0f);
            Gl.glPopMatrix();

            Gl.glColor3ub((byte)r2, (byte)g2, (byte)b2);
            Gl.glPushMatrix();
            Gl.glTranslated(0f, -0.3f, 0f);
            Gl.glScaled(0.33f, 0.3f, 0.33f);
            Glut.glutSolidCube(1.0f);
            Gl.glPopMatrix();
            Gl.glPopMatrix();
        }
        private int Function(OpenGL gl, double Counter, double iteration)
        {
            gl.Translate(0, 0, 0);

            if (iteration == 0)
            {
                CounterCube = 0;
                gl.Color((byte)ColorArray1[0], (byte)ColorArray2[0], (byte)ColorArray3[0]);
                Glut.glutSolidCube(0.1);
                gl.Translate(0, 0, -0.1);
            }
            else
            {
                G = iteration * 8;
                H1 = (G / 4) + 1;
                H2 = (G / 4) - 1;

                gl.Translate(0.2, -0.1, 0.2);
                Cube(gl, H1, iteration, Temp1, -0.1, 0, 0);
                if (Temp1 < H1) Temp1 += 1;

                Cube(gl, H2, iteration, Temp2, 0, 0, -0.1);
                if (Temp2 < H2 && Temp1 == H1) Temp2 += 1;

                gl.Translate(-0.1, 0, -0.1);
                Cube(gl, H1, iteration, Temp3, 0.1, 0, 0);
                if (Temp3 < H1 && Temp1 == H1 && Temp2 == H2) Temp3 += 1;

                Cube(gl, H2, iteration, Temp4, 0, 0, 0.1);
                if (Temp4 < H2 && Temp1 == H1 && Temp2 == H2 && Temp3 == H1) Temp4 += 1;
            }

            iteration += 1;

            if (Counter > iteration)
            {
                if (Temp1 == H1 && Temp2 == H2 && Temp3 == H1 && Temp4 == H2 && Count > Temp)
                { Temp1 = 0; Temp2 = 0; Temp3 = 0; Temp4 = 0; H1 = 0; H2 = 0; }
                return Function(gl, Counter, iteration);
            }
            else
                return 0;
        }
        private int Cube(OpenGL gl, double CounterCubes, double iteration, double Limit, double parameter1, double parameter2, double parameter3)
        {
            for (int j = 0; j < CounterCubes; j++)
            {

                if (Limit > j) Yes = 1;
                else if (iteration < (int)Temp - 1) Yes = 1;

                if (Yes == 1)
                {
                    CounterCube += 1;
                    Yes = 0;
                    gl.Translate(parameter1, parameter2, parameter3);
                    gl.Color((byte)ColorArray1[CounterCube], (byte)ColorArray2[CounterCube], (byte)ColorArray3[CounterCube]);
                    Glut.glutSolidCube(0.1);
                }
            }
            return 0;
        }
    public override void Recompile()
    {
        Gl.glNewList(idVisualizar, Gl.GL_COMPILE);
        Gl.glPushMatrix();
        Gl.glTranslated(start.x + ancho / 2.0, start.y - alto / 2.0, start.z - largo / 2.0);
        Gl.glScaled(this.ancho, this.alto, this.largo);

        Gl.glColor3fv(col);
        Glut.glutSolidCube(1);

//			Gl.glColor3d(1.0,1.0,0.2);
//			Gl.glBegin(Gl.gl.Gl.gl_POINTS);
//				Gl.glVertex3d(0,0,0);
//				Gl.glVertex3d(-0.5,0.5,0.5);
//			Gl.glEnd();

        Gl.glPopMatrix();
        Gl.glEndList();
    }
Beispiel #26
0
        private void MySolidCube(double size, int slices) //讓模型切得更細,這樣才會有很多法向量
        {
            double s = 1.0 / slices;                      //看一個小邊常要多少

            Gl.glPushMatrix();
            Gl.glScaled(size, size, size);
            for (int i = 0; i < slices; i++)
            {
                for (int j = 0; j < slices; j++)
                {
                    Gl.glPushMatrix();
                    Gl.glTranslated(-0.5 + i * s, 0.0, -0.5 + j * s); //讓他位移到下個位置
                    Gl.glScaled(s, 1.0, s);                           //把它縮放成一個小邊長的大小
                    Gl.glTranslated(0.5, 0.0, 0.5);
                    Glut.glutSolidCube(1.0);
                    Gl.glPopMatrix();
                }
            }
            Gl.glPopMatrix();
        }
Beispiel #27
0
        private void table(double topWid, double thickness, double legLength) //讓他可以調整他的大小寬度
        {
            Gl.glColor3ub(102, 51, 0);

            Gl.glPushMatrix();
            Gl.glScaled(topWid, thickness, topWid);
            // Glut.glutSolidCube(1.0);
            MySolidCube(1.0, 100);
            Gl.glPopMatrix();

            double d = (topWid / 2) * 0.7; //桌腳移動的位置

            Gl.glPushMatrix();
            Gl.glTranslated(d, 0.0, d);
            Gl.glTranslated(0.0, -legLength / 2, 0.0);
            Gl.glScaled(thickness, -legLength, thickness);
            Glut.glutSolidCube(1.0);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslated(d, 0.0, -d);
            Gl.glTranslated(0.0, -legLength / 2, 0.0);
            Gl.glScaled(thickness, -legLength, thickness);
            Glut.glutSolidCube(1.0);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslated(-d, 0.0, -d);
            Gl.glTranslated(0.0, -legLength / 2, 0.0);
            Gl.glScaled(thickness, -legLength, thickness);
            Glut.glutSolidCube(1.0);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslated(-d, 0.0, d);
            Gl.glTranslated(0.0, -legLength / 2, 0.0);
            Gl.glScaled(thickness, -legLength, thickness);
            Glut.glutSolidCube(1.0);
            Gl.glPopMatrix();
        }
Beispiel #28
0
        private static void DisplayObjects()
        {
            float[] torusDiffuse  = { 0.7f, 0.7f, 0.0f, 1.0f };
            float[] cubeDiffuse   = { 0.0f, 0.7f, 0.7f, 1.0f };
            float[] sphereDiffuse = { 0.7f, 0.0f, 0.7f, 1.0f };
            float[] octaDiffuse   = { 0.7f, 0.4f, 0.4f, 1.0f };

            Gl.glPushMatrix();
            Gl.glTranslatef(0.0f, 0.0f, -5.0f);
            Gl.glRotatef(30.0f, 1.0f, 0.0f, 0.0f);

            Gl.glPushMatrix();
            Gl.glTranslatef(-0.80f, 0.35f, 0.0f);
            Gl.glRotatef(100.0f, 1.0f, 0.0f, 0.0f);
            Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_DIFFUSE, torusDiffuse);
            Glut.glutSolidTorus(0.275f, 0.85f, 16, 16);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslatef(-0.75f, -0.50f, 0.0f);
            Gl.glRotatef(45.0f, 0.0f, 0.0f, 1.0f);
            Gl.glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
            Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_DIFFUSE, cubeDiffuse);
            Glut.glutSolidCube(1.5f);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslatef(0.75f, 0.60f, 0.0f);
            Gl.glRotatef(30.0f, 1.0f, 0.0f, 0.0f);
            Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_DIFFUSE, sphereDiffuse);
            Glut.glutSolidSphere(1.0f, 16, 16);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslatef(0.70f, -0.90f, 0.25f);
            Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_DIFFUSE, octaDiffuse);
            Glut.glutSolidOctahedron();
            Gl.glPopMatrix();
            Gl.glPopMatrix();
        }
        private void DrawCube()
        {
            //рисование куба с помощью библиотеки FreeGlut
            Gl.glDisable(Gl.GL_BLEND);
            Gl.glColor3f(Convert.ToSingle(_figureColor.R) / 255, Convert.ToSingle(_figureColor.G) / 255, Convert.ToSingle(_figureColor.B) / 255); //цвет фигуры без освещения

            Gl.glPushMatrix();                                                                                                                    // сохраняет текущие координаты
            Gl.glTranslated(0, 0, -5f);                                                                                                           // перенос по Z
            RotationGlut();

            if (Wire.Checked)
            {
                Glut.glutWireCube(1);// сеточный режим
            }
            else
            {
                Glut.glutSolidCube(1);//режим с заливкой
            }
            Gl.glPopMatrix();
            Gl.glDisable(Gl.GL_LIGHTING); // Будем рассчитывать освещенность
            Gl.glFlush();
        }
Beispiel #30
0
        private void DrawCube()
        {
            //рисование куба с помощью библиотеки FreeGlut
            Gl.glDisable(Gl.GL_BLEND);
            Gl.glColor3f(0.7f, 0.6f, 0.8f);

            Gl.glPushMatrix();          // сохраняет текущие координаты
            Gl.glTranslated(0, 0, -5f); // перенос по Z
            RotationGlut();

            if (Wire.Checked)
            {
                Glut.glutWireCube(1);// сеточный режим
            }
            else
            {
                Glut.glutSolidCube(1);//режим с заливкой
            }
            Gl.glPopMatrix();
            Gl.glDisable(Gl.GL_LIGHTING); // Будем рассчитывать освещенность
            Gl.glFlush();
        }