glMaterialf() private method

private glMaterialf ( uint face, uint pname, float param ) : void
face uint
pname uint
param float
return void
Ejemplo n.º 1
0
 public override void DrawToy(double[] translateCoords, double[] rotateCoords, bool isShadow)
 {
     float[] material = new float[3];
     material[0] = 0.0215f;
     material[1] = 0.1745f;
     material[2] = 0.0215f;
     GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, material);
     material[0] = 0.07568f;
     material[1] = 0.61424f;
     material[2] = 0.07568f;
     GL.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, material);
     material[0] = 0.633f;
     material[1] = 0.727811f;
     material[2] = 0.633f;
     GL.glMaterialfv(GL.GL_FRONT, GL.GL_SPECULAR, material);
     GL.glMaterialf(GL.GL_FRONT, GL.GL_SHININESS, 5f);
     GL.glTranslated(translateCoords[0], translateCoords[1], translateCoords[2]);
     if (!isShadow)
     {
         GL.glColor3d(1, 1, 1);
     }
     else
     {
         GL.glDisable(GL.GL_TEXTURE_2D);
     }
     GL.glRotated(rotateCoords[0], rotateCoords[1], rotateCoords[2], rotateCoords[3]);
     GL.glScaled(10, 10, 10);
     if (isShadow)
     {
         GL.glCallList(SHADOW_LIST);
     }
     else
     {
         GL.glCallList(LIST);
     }
     GL.glScaled(0.1, 0.1, 0.1);
     GL.glRotated(-rotateCoords[0], rotateCoords[1], rotateCoords[2], rotateCoords[3]);
     GL.glTranslated(-translateCoords[0], -translateCoords[1], -translateCoords[2]);
     GL.glDisable(GL.GL_TEXTURE_2D);
 }
Ejemplo n.º 2
0
        public void DrawRobot(bool isForShades)
        {
            GL.glPushMatrix();
            if (!isForShades)
            {
                GL.glColor4f(0f, 0f, 0.4f, 1f);
                GL.glEnable(GL.GL_COLOR_MATERIAL);
                GL.glMaterialf(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, 51.2f);
                GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, chrome_ambient);
                GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, chrome_diffuse);
                GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, chrome_specular);
            }

            GL.glTranslated(0, 0, 7.5);

            GL.glRotatef(180, 0, 1, 0);
            GL.glRotatef(-alfa, 0, 0, 1);
            GL.glTranslated(0, 0, updn);
            GL.glRotatef(bodyAngle, 0, 1, 0);
            GL.glPushMatrix();


            //torso
            if (isForShades)
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }

            GLU.gluCylinder(obj, 1.0, 1.0, 4.0, 50, 3);
            GLU.gluDisk(obj, 0, 1, 40, 20);
            GL.glTranslated(0, 0, 4);
            GLU.gluDisk(obj, 0, 1, 40, 20);
            GL.glTranslated(0, 0, -4);
            //head
            GL.glTranslated(0, 0, -r * 3);
            GLU.gluSphere(obj, r * 3, 20, 20);

            GL.glPopMatrix();

            GL.glPushMatrix();
            //right_upper_ARM

            GL.glTranslated(0, 1.3, 0.3);

            GL.glRotatef(right_upper_ARM_yangle, 0, 1, 0);
            GL.glRotatef(right_upper_ARM_xangle, 1, 0, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.4, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);
            //right_lower_ARM
            GL.glTranslated(0, 0, 1.7);
            GL.glRotatef(right_lower_ARM_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.1, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            GL.glPopMatrix();

            GL.glPushMatrix();

            //left_upper_ARM

            GL.glTranslated(0, -1.3, 0.3);
            GL.glRotatef(left_upper_ARM_yangle, 0, 1, 0);
            GL.glRotatef(left_upper_ARM_xangle, 1, 0, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.4, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            //left_lower_ARM

            /////
            GL.glTranslated(0, 0, 1.7);
            GL.glRotatef(left_lower_ARM_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.1, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            GL.glPopMatrix();

            GL.glPushMatrix();

            //left_LEG

            GL.glTranslated(0, -0.7, 4.2);
            GL.glRotatef(right_upper_LEG_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.5, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);
            GL.glTranslated(0, 0, 1.7);

            // right_lower_LEG

            GL.glRotatef(right_lower_LEG_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.1, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            GL.glPopMatrix();

            GL.glPushMatrix();

            //right_LEG

            GL.glTranslated(0, 0.7, 4.2);
            GL.glRotatef(left_upper_LEG_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.5, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);
            GL.glTranslated(0, 0, 1.7);
            //left_lower_LEG
            GL.glRotatef(left_lower_LEG_angle, 0, 1, 0);
            if (!isForShades)
            {
                GL.glColor3f(0.4f, 0.6f, 0f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluSphere(obj, r * 1.1, 20, 20);
            if (!isForShades)
            {
                GL.glColor3f(0, 0, 1f);
            }
            else
            {
                GL.glColor3f(0.2f, 0.2f, 0.2f);
            }
            GLU.gluCylinder(obj, 0.3, 0.3, 1.7, 50, 3);

            GL.glPopMatrix();

            GL.glPopMatrix();
        }