<pre name="code" class="cpp">#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
#include <GL/glu.h>
using namespace std;
static int shoulder=0,elbow=0,finger=0;
void init(void)
{
glClearColor(0,0,0,0);
glShadeModel(GL_FLAT);
}
void display(void)
{
//printf("use display\n");
glClear(GL_COLOR_BUFFER_BIT);
float mat[16];
glGetFloatv(GL_MODELVIEW_MATRIX, mat);
for(int i=0;i<16;++i)
{
printf("%f ",mat[i]);
}
printf("\n");
glGetFloatv(GL_PROJECTION_MATRIX, mat);
for(int i=0;i<16;++i)
{
printf("%f ",mat[i]);
}
printf("\n");
glPushMatrix();
glTranslatef(-3,0,0);//1
glRotatef((GLfloat)shoulder,0,0,1);//2
glTranslatef(1,0,0);//3
glPushMatrix();//top 1,2,3
glScalef(2,0.4,1);
glutWireCube(1);
glPopMatrix();//1,