大学のプロジェクト用に古いゲーム「Chuckieegg」を再現しています。以下のコードを使用してキャラクターをうまく描画しましたが、オブジェクトに色を付けるためにglBegin(?)でどのタイプを使用するかわかりません。
GL_QUADS、GL_TRIANGLE_FAN、GL_TRIANGLE_STRIP、GL_QUAD_STRIPを試しましたが、正しく表示されずに機能するのはGL_LINE_LOOPだけですが、もちろん、これでは形状全体が色付けされません。
誰かがこれを修正する方法を知っていますか?
void drawMan(void){
//main body outline
glBegin(GL_LINE_LOOP);
//set our colour
glColor3ub(255, 255, 0); // yellow
glVertex2f(-0.25f, 1.0f);
glVertex2f(0.25f, 1.0f);
glVertex2f(0.25f, 0.875f);
glVertex2f(0.5f, 0.875f);
glVertex2f(0.5f, 0.75f);
glVertex2f(1.0f, 0.75f);
glVertex2f(1.0f, 0.625f);
glVertex2f(0.5f, 0.625f);
glVertex2f(0.5f, 0.375f);
glVertex2f(0.0f, 0.375f);
glVertex2f(0.0f, 0.25f);
glVertex2f(0.25f, 0.25f);
glVertex2f(0.25f, 0.125f);
glVertex2f(0.5f, 0.125f);
glVertex2f(0.5f, 0.0f);
glVertex2f(0.75f, 0.0f);
glVertex2f(0.75f, -0.5f);
glVertex2f(0.5f, -0.5f);
glVertex2f(0.5f, -0.625f);
glVertex2f(0.25f, -0.625f);
glVertex2f(0.25f, -0.75f);
glVertex2f(0.0f, -0.75f);
glVertex2f(0.0f, -0.875f);
glVertex2f(0.25f, -0.875f);
glVertex2f(0.25f, -1.0f);
glVertex2f(-0.25f, -1.0f);
glVertex2f(-0.25f, -0.625f);
glVertex2f(-0.5f, -0.625f);
glVertex2f(-0.5f, -0.5f);
glVertex2f(-0.75f, -0.5f);
glVertex2f(-0.75f, 0.0f);
glVertex2f(-0.5f, 0.0f);
glVertex2f(-0.5f, 0.125f);
glVertex2f(-0.25f, 0.125f);
glVertex2f(-0.25f, 0.375f);
glVertex2f(-0.5f, 0.375f);
glVertex2f(-0.5f, 0.625f);
glVertex2f(-1.0f, 0.625f);
glVertex2f(-1.0f, 0.75f);
glVertex2f(-0.5f, 0.75f);
glVertex2f(-0.5f, 0.85f);
glVertex2f(-0.25f, 0.85f);
//glVertex2f(-0.25f, 1.0f);
glEnd();
//eyes
glBegin(GL_LINE_LOOP);
glColor3ub(0, 0, 0); // black
glVertex2f(0.0f, 0.625f);
glVertex2f(0.25f, 0.625f);
glVertex2f(0.25f, 0.5f);
glVertex2f(0.0f, 0.5f);
glEnd();
//arm
glBegin(GL_LINE_LOOP);
glColor3ub(0, 0, 0); // black
glVertex2f(-0.25f, 0.0f);
glVertex2f(0.0f, 0.0f);
glVertex2f(0.0f, -0.5f);
glVertex2f(-0.25f, -0.5f);
glEnd();}