Senin, 10 Oktober 2011

Tugas OpenGL

Dosen: Agam
Kelompok:
  • Natalia (34110917)
  • Elysa SimiHanggraini (39110626)
Kelas : 2DB13





Coding membuat Garis




glClearColor (0.0f, 0.0f, 0.0f, 0.0f);

glClear (GL_COLOR_BUFFER_BIT);



glPushMatrix ();

glClearColor(1,1,1,0);

glColor3f(1,1,1); //



glBegin(GL_LINES);

glVertex3f(0,0,-0.8);

glVertex3f(9.9,8.9,0.1);



glEnd ();

glPopMatrix ();


SwapBuffers (hDC);

Sleep (1);




outputnya adalah:









Coding membuat Kotak:



glClearColor (0.0f, 0.0f, 0.0f, 0.0f);

glClear (GL_COLOR_BUFFER_BIT);

glBegin (GL_POLYGON);

glColor3f (1.0f, 0.0f, 0.0f); glVertex2f (-0.5f, -0.5f);

glColor3f (0.0f, 1.0f, 0.0f); glVertex2f (-0.5f, 0.5f);

glColor3f (0.0f, 2.0f, 0.0f); glVertex2f (0.5f, 0.5f);

glColor3f (0.0f, 0.0f, 3.0f); glVertex2f (0.5f, -0.5f);

glEnd ();


SwapBuffers (hDC);



Sleep (1);



outputnya adalah:




Coding Membuat Segitiga:


glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
glClear (GL_COLOR_BUFFER_BIT);

glPushMatrix ();
glBegin (GL_TRIANGLES);
glColor3f (1.0f, 0.0f, 0.0f); glVertex2f (0.0f, 1.0f);
glColor3f (0.0f, 1.0f, 0.0f); glVertex2f (0.87f, -0.5f);
glColor3f (0.0f, 0.0f, 1.0f); glVertex2f (-0.87f, -0.5f);
glEnd ();
glPopMatrix ();

SwapBuffers (hDC);

theta += 1.0f;
Sleep (1);

outputnya adalah:



0 komentar:

Posting Komentar