知道来吱一声。

解决方案 »

  1.   

    这两句类似堆栈的push和pop操作。
    使用之前需要设定当前矩阵堆栈类型:modelview_matrix,或者project_matrix,还可以是纹理矩阵。
      

  2.   

    glPushMatrix(); glPopMatrix(); 最直观的例子
    draw_wheel_and_bolts()
    {
       long i;   draw_wheel();
       for(i=0;i<5;i++){
          glPushMatrix();
             glRotatef(72.0*i,0.0,0.0,1.0);
             glTranslatef(3.0,0.0,0.0);
             draw_bolt();
          glPopMatrix();
       }
    }draw_body_and_wheel_and_bolts()
    {
       draw_car_body();
       glPushMatrix();
          glTranslatef(40,0,30);                     /*move to first wheel position*/
          draw_wheel_and_bolts();
       glPopMatrix();
       glPushMatrix();
          glTranslatef(40,0,-30);                     /*move to 2nd wheel position*/
          draw_wheel_and_bolts();
       glPopMatrix();
       ...                  /*draw last two wheels similarly*/
    }