glColor3f(1.0,0.0,0.0);//我在这里上色
// 缩放、平移、旋转变换
glMatrixMode(GL_MODELVIEW); glLoadIdentity();
glScalef(m_xScaling,m_yScaling,m_zScaling);
glTranslatef(m_xHTranslation,m_yHTranslation,m_zHTranslation);
  glRotatef(m_xHRotation,1.0f,0.0f,0.0f);
glRotatef(m_yHRotation,0.0f,1.0f,0.0f);
glRotatef(m_zHRotation,0.0f,0.0f,1.0f);
    
auxSolidSphere(1.0);//这里画的图形确显示不了颜色,怎么回事啊?背景色到是能换,就是图形不能上色?

解决方案 »

  1.   

    颜色要和定义顶点数据放在一起的
    glColor3d( 0.0, 0.0, 0.8 );           
    auxSolidSphere(0.01*FrameShrinkRate);
      

  2.   

    我放在一起也没有用嘛
    glColor3f(1.0,0.0,0.0);
    auxSolidSphere(1.0);happy__888
    能不能说清楚点
      

  3.   

    GLfloat no_mat[] = { 0.0F,0.0F,0.0F,1.0F };
      GLfloat mat_ambient[] = { 0.7F,0.7F,0.7F,1.0F };
      GLfloat mat_ambient_color[] = { 0.8F,0.8F,0.2F,1.0F };
      GLfloat mat_diffuse[] = { 0.1F,0.5F,0.8F,1.0F };
      GLfloat mat_specular[] = { 1.0F,1.0F,1.0F,1.0F };
      GLfloat no_shininess[] = { 0.0F };
      GLfloat low_shininess[] = { 5.0F };
      GLfloat high_shininess[] = { 100.0F };
      GLfloat mat_emission[] = {0.3F,0.2F,0.2F,0.0F};  glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient);
      glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);
      glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
      glMaterialfv(GL_FRONT,GL_SHININESS,low_shininess);
      glMaterialfv(GL_FRONT,GL_EMISSION,no_mat);
      auxSolidSphere(1.0);