예제 #1
0
        public void display()                                            //robot hand display
        {
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); //clean colors and depth
            Gl.glLoadIdentity();                                         //Loading the identity matrix
            Glu.gluLookAt(0.0f, 2.0f, 10.0f,                             // eye position - point (0,2,10)
                          0.0f, 2.0f, 0.8f,                              // robot arm position - point (0,2.0,0)
                          0.0f, 1.0f, 0.0f);                             // camera location


            Gl.glColor3f(1.0f, 0.0f, 0.0f);           //Apply color to the base - red
            Gl.glRotatef(theta[0], 0.0f, 1.0f, 0.0f); //rotate the base along the y axis
            baze();


            Gl.glTranslatef(0.0f, Bazes_platums, 0.0f);
            Gl.glRotatef(theta[1], 1.0f, 0.0f, 0.0f); //rotate the upper arm along the x axis
            Gl.glColor3f(1.0f, 1.0f, 0.0f);           //Apply color to the upper hand - yellow
            Augsheja_roka();


            Gl.glTranslatef(0.0f, Augshejas_rokas_platums, 0.0f);
            Gl.glRotatef(theta[2], 1.0f, 0.0f, 0.0f); //rotate the lower arm along the x axis
            Gl.glColor3f(0.0f, 1.0f, 0.0f);           //Apply color to the lower hand - green
            Apaksheja_roka();

            Gl.glPushMatrix();
            Gl.glTranslatef(0.0f, Apakshejas_rokas_platums, 0.25f);
            Gl.glRotatef(theta[3], 1.0f, 0.0f, 0.0f); //rotate the upper fingers along the x axis
            Gl.glColor3f(1.0f, 0.0f, 0.0f);           //Apply color to the upper fingers - red
            augshejie_pirksti(0.28f);
            augshejie_pirksti(0.08f);
            augshejie_pirksti(-0.1f);
            augshejie_pirksti(-0.3f);

            Gl.glTranslatef(0.0f, Augshejo_pirkstu_platums, 0.0f);
            Gl.glRotatef(theta[4], 1.0f, 0.0f, 0.0f); //rotate the lower fingers along the x axis
            Gl.glColor3f(1.0f, 1.0f, 0.0f);           //Apply color to the lower fingers - yellow
            apakshejie_pirksti(0.28f);
            apakshejie_pirksti(0.08f);
            apakshejie_pirksti(-0.1f);
            apakshejie_pirksti(-0.3f);

            Gl.glPopMatrix();


            Gl.glTranslatef(0.15f, 3.0f, -0.25f);
            Gl.glRotatef(theta[5], 1.0f, 0.0f, 0.0f); //rotate the upper thumb along the x-axis
            Gl.glColor3f(1.0f, 0.0f, 0.0f);           //Apply color to the upper thumb - red
            augshejs_ikshkis(0.10f);

            Gl.glTranslatef(0.0f, 0.4f, 0.0f);
            Gl.glRotatef(theta[6], 1.0f, 0.0f, 0.0f); //rotate the lower thumb along the x axis
            Gl.glColor3f(1.0f, 1.0f, 0.0f);           //Apply color to the lower part of the thumb - yellow
            apakshejs_ikshkis(0.10f);

            Gl.glFlush();
            SK.Invalidate();
        }