###前提・実現したいこと
ロケットの噴射口の部分の両面に異なる表面属性を設定する
###発生している問題
噴射口の両面に異なる表面属性がついているが、胴体部分の表面属性が反映されない
###該当のソースコード
c++
1if(shadeFlag==GL_TRUE) 2 { 3 glEnable( GL_LIGHTING ); 4 } 5 glEnable( GL_NORMALIZE ); 6 glNormal3f(0.0, 1.0, 0.0); 7 glPushMatrix(); 8 glEnable(GL_LIGHTING); 9 glRotatef(theta*0.4, 0.0, 1.0, 0.0); 10 glTranslatef(0.0, 1.0, 0.0); 11 if (wireFlag == GL_TRUE) 12 myWireCylinder(1.0, 2.0, 12); 13 else 14 mySolidCylinder(1.0, 2.0, 20); 15 glTranslatef( 0.0, 1.0, 0.0); 16 glRotatef( -90.0, 1.0, 0.0, 0.0 ); 17 glScalef( 1.0 , 1.0 , 1.0 ); 18 if(wireFlag==GL_TRUE) 19 glutWireCone( 1.0, 2.0, 12, 3 ); 20 else 21 glutSolidCone( 1.0, 2.0, 20, 3); 22 glPopMatrix(); 23 24 glPushMatrix(); 25 glRotatef( theta*1.0, 0.0, 1.0, 0.0 ); 26 glTranslatef(0.0, -1.0, 0.0); 27 if(moveFlag==GL_TRUE) 28 glTranslatef( 0.0, fly, 0.0); 29 else fly=0.0; 30 if(wireFlag==GL_TRUE) 31 myWireCylinder( 1.0, 2.0, 12 ); 32 else 33 mySolidCylinder( 1.0, 2.0, 20 ); 34 glEnable( GL_NORMALIZE ); 35 for (i = 0; i < 4; i++){ 36 glPushMatrix(); 37 glEnable(GL_LIGHTING); 38 glRotatef(90.0*(float)i, 0.0, 1.0, 0.0); 39 glTranslatef(1.5, 1.0, 0.0); 40 glScalef(1.0, 2.0, 0.3); 41 if (wireFlag == GL_TRUE) 42 glutWireCube(1.0); 43 else 44 glutSolidCube(1.0); 45 glPopMatrix(); 46 } 47 glPushMatrix(); 48 if (moveFlag == GL_TRUE){ 49 //glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); 50 glRotatef(theta*0.01, 0.0, 1.0, 0.0); 51 } 52 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); 53 glMaterialfv(GL_FRONT, GL_DIFFUSE, blue); 54 glMaterialfv(GL_BACK, GL_DIFFUSE, yellow); 55 glTranslatef( 0.0, -1.4, 0.0); 56 glRotatef( -90.0 , 1.0 ,0.0 , 0.0 ); 57 if(wireFlag==GL_TRUE) 58 glutWireCone( 0.9 , 0.9 ,12, 3); 59 else 60 glutSolidCone( 0.9 , 0.9 ,20, 3); 61 glDisable(GL_LIGHTING); 62 glPopMatrix(); 63 64 glPopMatrix(); 65 66 glPopMatrix(); 67 glutSwapBuffers(); 68}
###補足情報
opengl
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。