Rabu, 06 Januari 2010
Listing Palles C - Rumah
mulaiOpenGL();
//
// mulai looping utama program
float atas = 0.0f;
float bawah = -1.0f;
...
// lakukan penggambaran di sini
//---------------------------------------------
glTranslatef(-3.0f,-5.0f,-60.0f);
glRotatef(atas,0.0f,1.0f,0.0f);
glRotatef(bawah,1.0f,0.0f,0.0f);
glBegin(GL_QUADS);
//kubus Atas
glColor3ub(200,100,50);
glVertex3f(-15.0f,5.0f,15.0f); glVertex3f(15.0f,5.0f,15.0f);
glVertex3f(15.0f,5.0f,-15.0f); glVertex3f(-15.0f,5.0f,-15.0f);
//kubus Bawah
glColor3ub(50,100,200);
glVertex3f(-10.0f,-10.0f,10.0f); glVertex3f(10.0f,-10.0f,10.0f);
glVertex3f(10.0f,-10.0f,-10.0f); glVertex3f(-10.0f,-10.0f,-10.0f);
//kubus Kanan
glColor3ub(100,10,200);
glVertex3f(10.0f,5.0f,10.0f); glVertex3f(10.0f,-10.0f,10.0f);
glVertex3f(10.0f,-10.0f,-10.0f); glVertex3f(10.0f,5.0f,-10.0f);
//Kubus Kiri
glColor3ub(200,10,100);
glVertex3f(-10.0f,5.0f,10.0f); glVertex3f(-10.0f,-10.0f,10.0f);
glVertex3f(-10.0f,-10.0f,-10.0f); glVertex3f(-10.0f,5.0f,-10.0f);
//Kubus Depan
glColor3ub(10,200,100);
glVertex3f(-10.0f,5.0f,10.0f); glVertex3f(-10.0f,-10.0f,10.0f);
glVertex3f(10.0f,-10.0f,10.0f); glVertex3f(10.0f,5.0f,10.0f);
//Kubus Belakang
glColor3ub(100,200,10);
glVertex3f(-10.0f,5.0f,-10.0f); glVertex3f(-10.0f,-10.0f,-10.0f);
glVertex3f(10.0f,-10.0f,-10.0f); glVertex3f(10.0f,5.0f,-10.0f);
glEnd();
glBegin(GL_TRIANGLES);
//Limas Depan
glColor3ub(180,200,50);
glVertex3f(-15.0f,5.0f,15.0f); glVertex3f(15.0f,5.0f,15.0f);
glVertex3f(0.0f,15.0f,0.0f);
//Limas Belakang
glColor3ub(50,200,180);
glVertex3f(-15.0f,5.0f,-15.0f); glVertex3f(15.0f,5.0f,-15.0f);
glVertex3f(0.0f,15.0f,0.0f);
//Limas kanan
glColor3ub(250,50,150);
glVertex3f(15.0f,5.0f,15.0f); glVertex3f(15.0f,5.0f,-15.0f);
glVertex3f(0.0f,15.0f,0.0f);
//Limas Kiri
glColor3ub(150,50,250);
glVertex3f(-15.0f,5.0f,-15.0f); glVertex3f(-15.0f,5.0f,15.0f);
glVertex3f(0.0f,15.0f,0.0f);
glEnd();
if(glfwGetKey(GLFW_KEY_UP))bawah -=1.1f;
if(glfwGetKey(GLFW_KEY_DOWN))bawah +=1.1f;
if(glfwGetKey(GLFW_KEY_RIGHT))atas +=1.1f;
if(glfwGetKey(GLFW_KEY_LEFT))atas -=1.1f;
//-----------------------------------------------
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar