Beispiel #1
0
        public void     butterflydraw()
        {
            GLU.gluQuadricNormals(q1, GLU.GLU_SMOOTH);
            GLU.gluQuadricTexture(q1, 1);
            GL.glTranslatef(0.1f, 0.0f, 0);
            GL.glRotatef(90, 1.0f, 0.0f, 0.0f);
            GL.glColor3f(0.5f, 0.24f, 0.43f);
            GLU.gluCylinder(q1, 0.1, 0.1, 0.5f, 13, 13);

            GL.glTranslatef(0.11f, 0.19f, 0);
            GLU.gluSphere(q1, 0.15, 32, 32);

            GL.glTranslatef(1.19f, 0, 0);
            GL.glBegin(GL.GL_TRIANGLES);                                        // start drawing a triangle
            GL.glColor3f(1.0f, 0.0f, 0.0f);                                     // red
            GL.glVertex3f(0.2f, 0.5f, 0.0f);                                    // top point of the triangle
            GL.glColor3f(0.0f, 1.0f, 0.0f);                                     // green
            GL.glVertex3f(-0.1f, -0.25f, 0.0f);                                 // left point of the triangle
            GL.glColor3f(0.0f, 0.0f, 1.0f);                                     // blue
            GL.glVertex3f(0.5f, -0.7f, 0.0f);                                   // right point of the triangle
            GL.glEnd();

            GL.glTranslatef(1.19f, 0, 0);
            GL.glBegin(GL.GL_TRIANGLES);                                        // start drawing a triangle
            GL.glColor3f(1.0f, 0.0f, 0.0f);                                     // red
            GL.glVertex3f(-0.3f, 0.5f, 0.0f);                                   // top point of the triangle
            GL.glColor3f(0.0f, 1.0f, 0.0f);                                     // green
            GL.glVertex3f(0.0f, -0.25f, 0.0f);                                  // left point of the triangle
            GL.glColor3f(0.0f, 0.0f, 1.0f);                                     // blue
            GL.glVertex3f(-0.5f, -0.7f, 0.0f);                                  // right point of the triangle
            GL.glEnd();
        }
Beispiel #2
0
        public void schieber()
        {
            //Schieber zeichnen
            GL.glTranslated(0.0, 0.0, targetArmLength);
            GL.glRotated(0, 0, 0, 0);
            GL.glColor3f(1.0f, 1.0f, 0.0f);
            GLUquadric schieber = GL.gluNewQuadric();

            GLU.gluCylinder(schieber, 0.15, 0.15, 0.1, 20, 10);
        }
Beispiel #3
0
        public void ausleger()
        {
            //Ausleger zeichnen
            GL.glTranslated(0.0, 0.0, 0.0);
            GL.glRotated(90, 0, 1, 0);
            GL.glColor3f(1.0f, 0.0f, 0.0f);
            GLUquadric ausleger = GL.gluNewQuadric();

            GLU.gluCylinder(ausleger, 0.1, 0.1, 2, 20, 10);
        }
Beispiel #4
0
        public void seil()
        {
            //Seil zeichnen
            //GL.glTranslated(0.0, 0.0, targetArmLength);
            GL.glTranslated(-0.15, 0.0, 0.05);
            GL.glRotated(-90, 0, 1, 0);
            GL.glColor3f(0.0f, 1.0f, 0.0f);
            GLUquadric seil = GL.gluNewQuadric();

            GLU.gluCylinder(seil, 0.01, 0.01, targetRopeLength, 20, 10);
        }
Beispiel #5
0
        public void turm()
        {
            //Perspektive 90° auf die X-Achse
            GL.glRotated(90, 1, 0, 0);

            //Turm Zeichnen
            //lässt den Zylinder rotieren
            GL.glRotated(targetAngle, 0, 1, 0);

            GL.glTranslated(0.0, 0.0, 0.0);
            GL.glRotated(90, 1, 0, 0);      //Rotation des Objektes (Winkel, X, Y, Z)
            GL.glColor3f(0.0f, 0.0f, 1.0f); //Farbe des Objektes (R,G,B)
            // Zylinderobjekt erzeugen
            GLUquadric zylinder = GL.gluNewQuadric();

            GLU.gluCylinder(zylinder, 0.1, 0.1, 3, 20, 10);
        }
Beispiel #6
0
 public void drawSelf()
 {
     GL.glPushMatrix();
     GL.glTranslatef(posX, posY, posZ);
     if (type == 2)
     {
         if (lazersize < 10)
         {
             lazersize += 0.2f;
         }
         GL.glColor3f(0.7f, 0.7f, 1.0f);
         GL.glRotatef(rotation, 0.0f, 1.0f, 0.0f);
         GLU.gluCylinder(obj, bulletsize, bulletsize, lazersize, 8, 8);
     }
     else
     {
         GL.glColor3f(0.0f, 0.0f, 0.0f);
         GLUT.glutSolidSphere(bulletsize, 8, 8);
     }
     GL.glPopMatrix();
 }
Beispiel #7
0
        private void DrawHandle(bool isShadow)
        {
            GL.glRotatef(10, 1, 0, 0);
            GL.glTranslated(0, 0, 2.3f);
            if (!isShadow)
            {
                GL.glColor3f(0, 1, 0.2f);
            }
            GL.glTranslated(-0.7, -0.1, 0.1);
            GLU.gluSphere(m_Quadric, 0.38, 20, 20);
            GL.glTranslated(1.7, 0, 0);
            if (!isShadow)
            {
                GL.glColor3f(0, 0.6f, 1);
            }
            GLU.gluSphere(m_Quadric, 0.38, 20, 20);
            GL.glTranslated(-1.7, 0, 0);
            GL.glRotatef(HandleUpDownAngle, 1, 0, 0);
            GL.glRotatef(HandleLeftRightAngle, 0, 1, 0);
            //------------------------------
            if (!isShadow)
            {
                GL.glColor3d(0, 0, 0);
            }
            //black pole
            GLU.gluCylinder(m_Quadric, 0.08, 0.08, 1, 20, 20);
            GL.glTranslated(0, 0, 1);
            if (!isShadow)
            {
                GL.glColor3f(1, 0, 0);
            }
            //red handle
            GLU.gluSphere(m_Quadric, 0.2, 20, 20);
            GL.glRotatef(-HandleUpDownAngle - 10, 1, 0, 0);

            GL.glTranslated(0.7, 0, -3.16f);
            GL.glRotatef(-HandleLeftRightAngle, 0, 1, 0);
        }
Beispiel #8
0
        unsafe public void showHolesCylider()
        {
            GL.glPushMatrix();
            GL.glNewList(2000, GL.GL_COMPILE);
            GL.glEnable(GL.GL_COLOR_MATERIAL);
            GL.glColorMaterial(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE);
            GL.glColor3d(0.5, 0.5, 1);
            GL.glBegin(GL.GL_POINTS);
//             GL.glPointSize(3);
            for (int i = 0; i < holes.Count; i++)
            {
                GL.glPushMatrix();
                IntPtr pObj;
                pObj = GLU.gluNewQuadric();
                GL.glTranslated(holes[i].X, holes[i].Y, holes[i].Z - 1000);
                GLU.gluCylinder(pObj, 5, 5, 600, 20, 20);
                GL.glPopMatrix();
//                 GL.glVertex3d(holes[i].X, holes[i].Y, holes[i].Z);
            }
            GL.glEnd();
            GL.glEndList();
            GL.glPopMatrix();
        }
Beispiel #9
0
        void makeRectangularPrism(float x1, float y1, float z1, float x2, float y2, float z2)
        {
            float width = (x2 - x1) / 2;

            if (width < 1)
            {
                width = -width;
            }
            float height = (y2 - y1) / 2;

            if (height < 1)
            {
                height = -height;
            }
            float depth = (z2 - z1) / 2;

            if (depth < 1)
            {
                depth = -depth;
            }

            GL.glColor3f(0.273f, 0.252f, 0.135f);     //army-green light

            GL.glBegin(GL.GL_QUADS);
            //Front
            GL.glNormal3f(0.0f, 0.0f, -1.0f);
            GL.glVertex3f(-width, -height, depth);
            GL.glVertex3f(width, -height, depth);
            GL.glVertex3f(width, height, depth);
            GL.glVertex3f(-width, height, depth);
            //Top
            GL.glNormal3f(0.0f, 1.0f, 0.0f);
            GL.glVertex3f(-width, height, -depth);
            GL.glVertex3f(-width, height, depth);
            GL.glVertex3f(width, height, depth);
            GL.glVertex3f(width, height, -depth);
            //Bottom
            GL.glNormal3f(0.0f, -1.0f, 0.0f);
            GL.glVertex3f(-width, -height, -depth);
            GL.glVertex3f(-width, -height, depth);
            GL.glVertex3f(width, -height, depth);
            GL.glVertex3f(width, -height, -depth);
            //Right
            GL.glNormal3f(1.0f, 0.0f, 0.0f);
            GL.glVertex3f(width, -height, -depth);
            GL.glVertex3f(width, height, -depth);
            GL.glVertex3f(width, height, depth);
            GL.glVertex3f(width, -height, depth);
            //Left
            GL.glNormal3f(-1.0f, 0.0f, 0.0f);
            GL.glVertex3f(-width, -height, -depth);
            GL.glVertex3f(-width, -height, depth);
            GL.glVertex3f(-width, height, depth);
            GL.glVertex3f(-width, height, -depth);
            GL.glEnd();

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

            GL.glColor3f(1, 1, 1);     //white
            GL.glBegin(GL.GL_QUADS);
            //Back
            GL.glNormal3f(0.0f, 0.0f, 1.0f);
            GL.glTexCoord2f(0, 0);
            GL.glVertex3f(-width, -height, -depth);
            GL.glTexCoord2f(0, 1);
            GL.glVertex3f(-width, height, -depth);
            GL.glTexCoord2f(1, 1);
            GL.glVertex3f(width, height, -depth);
            GL.glTexCoord2f(1, 0);
            GL.glVertex3f(width, -height, -depth);
            GL.glEnd();

            GLUquadric obj;

            obj = GLU.gluNewQuadric(); //!!!

            //barrel
            GL.glPushMatrix();
            GL.glTranslatef(0.0f, 0.025f, -1f);
            GLU.gluCylinder(obj, 0.05, 0.05, 1.2, 10, 2);
            GL.glPopMatrix();

            GL.glDisable(GL.GL_TEXTURE_2D);//!!!
        }
Beispiel #10
0
        void makeRectangularPrismstelth(float x1, float y1, float z1, float x2, float y2, float z2)
        {
            float width = (x2 - x1) / 2;

            if (width < 1)
            {
                width = -width;
            }
            float height = (y2 - y1) / 2;

            if (height < 1)
            {
                height = -height;
            }
            float depth = (z2 - z1) / 2;

            if (depth < 1)
            {
                depth = -depth;
            }
            if (TankType == 2)
            {
                height = 0.25f * height;
                GL.glTranslatef(0.0f, -0.3f, 0);
            }
            GL.glColor4f(0.2f, 0.2f, 0.2f, 1f); //black stelth
            GL.glBegin(GL.GL_QUADS);
            //Front
            GL.glNormal3f(0.0f, 0.0f, -1.0f);
            GL.glVertex3f(-width, -height, depth);
            GL.glVertex3f(width, -height, depth);
            GL.glVertex3f(width, height, depth);
            GL.glVertex3f(-width, height, depth);
            //Top
            GL.glNormal3f(0.0f, 1.0f, 0.0f);
            GL.glVertex3f(-width, height, -depth);
            GL.glVertex3f(-width, height, depth);
            GL.glVertex3f(width, height, depth);
            GL.glVertex3f(width, height, -depth);
            //Bottom
            GL.glNormal3f(0.0f, -1.0f, 0.0f);
            GL.glVertex3f(-width, -height, -depth);
            GL.glVertex3f(-width, -height, depth);
            GL.glVertex3f(width, -height, depth);
            GL.glVertex3f(width, -height, -depth);
            //Right
            GL.glNormal3f(1.0f, 0.0f, 0.0f);
            GL.glVertex3f(width, -height, -depth);
            GL.glVertex3f(width, height, -depth);
            GL.glVertex3f(width, height, depth);
            GL.glVertex3f(width, -height, depth);
            //Left
            GL.glNormal3f(-1.0f, 0.0f, 0.0f);
            GL.glVertex3f(-width, -height, -depth);
            GL.glVertex3f(-width, -height, depth);
            GL.glVertex3f(-width, height, depth);
            GL.glVertex3f(-width, height, -depth);
            GL.glEnd();

            GL.glColor4f(0.2f, 0.2f, 0.2f, 1f); //black stelth
            GL.glBegin(GL.GL_QUADS);
            //Back
            GL.glNormal3f(0.0f, 0.0f, 1.0f);
            GL.glVertex3f(-width, -height, -depth);
            GL.glVertex3f(-width, height, -depth);
            GL.glVertex3f(width, height, -depth);
            GL.glVertex3f(width, -height, -depth);
            GL.glEnd();

            GLUquadric obj;

            obj = GLU.gluNewQuadric(); //!!!

            //barrel
            GL.glPushMatrix();
            GL.glTranslatef(0.0f, 0.025f, -1f);
            GLU.gluCylinder(obj, 0.05, 0.05, 1.2, 10, 2);
            GL.glPopMatrix();
        }
Beispiel #11
0
        public void DrawClaw(double[] translateCoords, bool isShadow)
        {
            if (!isShadow)
            {
                GL.glColor3f(0.7f, 0.7f, 0.0f);
            }
            GL.glTranslated(translateCoords[0], translateCoords[1], translateCoords[2]);
            GL.glBegin(GL.GL_QUADS);
            //1

            GL.glVertex3d(-0.3f, -0.35f, -0.3f);
            GL.glVertex3d(-0.3f, 0f, -0.3f);
            GL.glVertex3d(0.3f, 0f, -0.3f);
            GL.glVertex3d(0.3f, -0.35f, -0.3f);

            //2
            GL.glVertex3f(-0.3f, -0.35f, -0.3f);
            GL.glVertex3f(-0.3f, -0.35f, 0.3f);
            GL.glVertex3f(-0.3f, 0f, 0.3f);
            GL.glVertex3f(-0.3f, 0f, -0.3f);
            //3

            GL.glVertex3f(-0.3f, -0.35f, -0.3f);
            GL.glVertex3f(0.3f, -0.35f, -0.3f);
            GL.glVertex3f(0.3f, -0.35f, 0.3f);
            GL.glVertex3f(-0.3f, -0.35f, 0.3f);


            //4
            GL.glVertex3f(0.3f, -0.35f, -0.3f);
            GL.glVertex3f(0.3f, -0.35f, 0.3f);
            GL.glVertex3f(0.3f, 0f, 0.3f);
            GL.glVertex3f(0.3f, 0f, -0.3f);


            //5
            GL.glVertex3f(0.3f, 0f, 0.3f);
            GL.glVertex3f(0.3f, 0f, -0.3f);
            GL.glVertex3f(-0.3f, 0f, -0.3f);
            GL.glVertex3f(-0.3f, 0f, 0.3f);
            //6
            GL.glVertex3f(0.3f, 0f, 0.3f);
            GL.glVertex3f(-0.3f, 0f, 0.3f);
            GL.glVertex3f(-0.3f, -0.35f, 0.3f);
            GL.glVertex3f(0.3f, -0.35f, 0.3f);

            GL.glEnd();



            GL.glTranslated(0, -CableLength, 0);
            GL.glRotated(-90, 1, 0, 0);
            if (!isShadow)
            {
                GL.glColor3d(0.06, 0.06, 0.06);
            }
            GLU.gluCylinder(m_Quadric, 0.02, 0.02, CableLength, 20, 20);
            GL.glRotated(90, 1, 0, 0);
            GL.glScaled(5, 5, 5);
            GL.glCallList(LIST);
            GL.glScaled(0.2, 0.2, 0.2);
            GL.glTranslated(-translateCoords[0], -translateCoords[1] + CableLength, -translateCoords[2]);
        }
Beispiel #12
0
        /// <summary>
        /// Zeichnet die Objekte
        /// </summary>
        public void draw()
        {
            // Verschieben des Koordinatensystems um -6 in Z-Richtung
            // also "nach hinten"
            // und kippen nach Oben
            GL.glTranslated(0.0, 0.0, -6.0);


            //---------------
            //BLAUER ZYLINDER1
            //Vorgabe der Perspektive (90° auf die X-Achse) für das im folgenden erzeugte Objekt
            GL.glRotated(90, 1, 0, 0);

            //lässt den Zylinder (blau) rotieren mithilfe des Schiebereglers
            GL.glRotated(targetAngle, 0, 0, 1);

            // Zylinderobjekt erzeugen
            GLUquadric zylinder = GL.gluNewQuadric();

            // Zeicheneigenschaften einstellen:
            // Drahtgittermodell
            GLU.gluQuadricDrawStyle(zylinder, GLU.GLU_LINE);

            // ab jetzt in blau zeichnen
            GL.glColor3f(0.0f, 0.0f, 1.0f);

            // Zeichnen des eigentlichen Zylinders
            // bottom-Durchmesser, top-Durchmesser, Höhe,
            // Anzahl der Linien-Segmente
            // Anzahl der Linien in der Höhe
            GLU.gluCylinder(zylinder, 0.2, 0.2, 2, 200, 100);
            //---------------

            //MAGENTA ZYLINDER2
            GL.glTranslated(0.0, 0.0, 0.0);
            GL.glRotated(120, 0, 1, 0);
            GL.glColor3f(1.0f, 0.0f, 1.0f);
            GLUquadric zylinder2 = GL.gluNewQuadric();

            GLU.gluCylinder(zylinder2, 0.1, 0.1, 1.5, 20, 10);

            //GRÜNER ZYLINDER3
            GL.glTranslated(0.0, 0.0, 1.5);
            GL.glRotated(-60, 0, 1, 0);
            GL.glColor3f(0.0f, 1.0f, 0.0f);
            GLUquadric zylinder3 = GL.gluNewQuadric();

            GLU.gluCylinder(zylinder3, 0.1, 0.1, targetArmLength, 20, 10);

            //ROTER ZYLINDER4
            //GL.glTranslated(0.0, 0.0, targetArmLength); targetArmLength bezieht sich hier auf die Position des Vorgängerobjekts
            GL.glTranslated(0.0, 0.0, targetArmLength);
            GL.glRotated(-60, 0, 1, 0);
            GL.glColor3f(1.0f, 0.0f, 0.0f);
            GLUquadric zylinder4 = GL.gluNewQuadric();

            GLU.gluCylinder(zylinder4, 0.01, 0.01, targetRopeLength, 20, 10);

            //GELBE KUGEL
            //GL.glTranslated(0.0, 0.0, targetRopeLength); targetRopeLength bezieht sich hier auf die Position des Vorgängerobjekts
            GL.glTranslated(0.0, 0.0, targetRopeLength);
            GL.glRotated(0, 0, 0, 0);
            GL.glColor3f(1.0f, 1.00f, 0.00f);
            GLUT.glutWireSphere(targetBowlDiameter, 100, 150);
        }