Minggu, 28 Oktober 2012

Tugas Grafik Komputer dan Pengolahan Citra

Nama: Mohammad Fajar Ikhsan
NPM: 14110494
Kelas: 3 KA 33

Untuk Membuat Tampilan Garis Vertikal

Untuk membuat garis vertikal kita bisa tuliskan koding seperti gambar di bawah ini :
 
 
 
source codenya dibawah ini :


/* OpenGL animation code goes here */

glClearColor (8.1f, 0.1f, 0.1f, 0.7f);

glClear (GL_COLOR_BUFFER_BIT);



glPushMatrix ();

glClearColor(1,1,1,0);

glColor3f(1,1,1); //



glBegin(GL_LINES);

glVertex3f(0,0,-0.0);

glVertex3f(0.0,130.0,0.0);

/////////////////////////////////



glEnd ();

glPopMatrix ();



SwapBuffers (hDC);



Sleep (1);

}
}


Untuk Membuat Tampilan Garis Horizontal

Untuk membuat garis horizontal kita bisa tuliskan koding seperti gambar di bawah ini :


source codenya dibawah ini :

/* OpenGL animation code goes here */

glClearColor (0.1f, 0.1f, 0.9f, 0.9f);

glClear (GL_COLOR_BUFFER_BIT);



glPushMatrix ();

glClearColor(1,1,1,0);

glColor3f(1,1,1); //



glBegin(GL_LINES);

glVertex3f(0,0,-0.0);

glVertex3f(0.3,0.0,0.0);

/////////////////////////////////



glEnd ();

glPopMatrix ();



SwapBuffers (hDC);



Sleep (1);

}

}


Untuk Membuat Tampilan Garis Diagonal

Untuk membuat garis diagonal kita bisa tuliskan koding seperti gambar di bawah ini :



source codenya dibawah ini :


/* OpenGL animation code goes here */

glClearColor (9.1f, 0.1f, 0.1f, 0.1f);

glClear (GL_COLOR_BUFFER_BIT);



glPushMatrix ();

glClearColor(1,1,1,0);

glColor3f(1,1,1); //



glBegin(GL_LINES);

glVertex3f(0,0,-0.0);

glVertex3f(0.9,0.9,0.0);

/////////////////////////////////



glEnd ();

glPopMatrix ();



SwapBuffers (hDC);



Sleep (1);

}

}

Compile project tersebut, dengan cara Execute >> Compile atau dengan shortcut (Ctrl + F9). Jika project berhasil di compile dan muncul tulisan done maka jalankan program tersebut dengan cara Execute >> Run atau dengan shortcut (Ctrl + F10)

Akan menghasilkan gambar sebagai berikut:



OUTPUT GARIS VERTIKAL



OUTPUT GARIS HORIZONTAL



OUTPUT GARIS DIAGONAL