GRAFIKA KOMPUTER - MEMBUAT 4 GAMBAR BANGUN SEGITIGA DENGAN DEV C++ OPENGL
Langkah-langkah
Membuat Program :
1.      Buka
Aplikasi Dev C++ yang sudah di Instal
Untuk memulai membuat program pilih File
– New – Project – Ok
2.      Setelah
New Project akan tampil jenis lembar kerja yang akan digunakan, Klik Conole
Application – OK
3.      Setelah
itu Save
Project, Klik Save
4.      Setelah
itu akan muncul tampilan awal, kemudian Klik Kanan pada Bar Project1, lalu
pilih Project Options
5.      Pada
Project Options, Klik Parameters – Linker
Pada
Box Linker ketik -lopengl32, -lfreeglut, -lglu32, lalu klik OK
6.      Pada
Lembar Kerja akan Muncul Scrip seperti ini :
7.      Kosongkan
Script dan Ketikan script dengan projek yang akan dibuat seperti dibawah ini:
Syntak Program :
| 
#include <GL/glut.h>                                           
#include <windows.h>         
void init (void) {     
glClearColor (1.0, 1.0, 1.0, 0.0);         
glLineWidth (1.0);                 
glColor3f (1.0, 0.0, 0.0);                                       
glOrtho (-6,6, -6,6, -6,6);     
}                                                                
void Display (void) {                              
glClear (GL_COLOR_BUFFER_BIT);     
glBegin (GL_LINES);              
glVertex2f (-5.5, 0.0);                           
glColor3f (1.0, 0.0, 0.0); 
glVertex2f (5.5, 0.0);                            
glEnd ();                  
glBegin (GL_LINES);                              
glVertex2f (0.0, -5.5);           
glColor3f (1.0, 0.0, 0.0);       
glVertex2f (0.0, 5.5);                            
glEnd ();                                                  
glBegin (GL_TRIANGLES);                                     
glColor3f (1.0, 0.0, 0.0);                       
glVertex2f (1.0, 1.0);                            
glColor3f (0.0, 0.0, 1.0);                       
glVertex2f (3.0, 1.0);  
glColor3f (0.0, 1.0, 0.0);  
glVertex2f (2.0, 4.0);  
glEnd (); 
glBegin (GL_TRIANGLES);                                     
glColor3f (0.0, 1.0, 0.0);                       
glVertex2f (-2.0, -1.0);                         
glColor3f (1.0, 0.0, 0.0);                       
glVertex2f (-3.0, -4.0);  
glColor3f (0.0, 0.0, 1.0);  
glVertex2f (-1.0, -4.0);   
glEnd (); 
glBegin (GL_TRIANGLES);                                     
glColor3f (1.0, 1.0, 0.0);                       
glVertex2f (1.0, -1.0);                           
glColor3f (0.0, 1.0, 1.0);                       
glVertex2f (2.0, -4.0);  
glColor3f (1.0, 0.43, 0.78);  
glVertex2f (3.0, -1.0);  
glEnd (); 
glBegin (GL_TRIANGLES);                                     
glColor3f (1.0, 0.43, 0.78);                  
glVertex2f (-1.0, 4.0); 
glColor3f (1.0, 1.0, 0.0);                       
glVertex2f (-3.0, 4.0);                           
glColor3f (0.0, 1.0, 1.0);                       
glVertex2f (-2.0, 1.0);  
glEnd (); 
glutSwapBuffers (); 
} 
int main (int argc, char** argv) {        
glutInit (&argc, argv);           
glutInitDisplayMode (GLUT_DOUBLE |
GLUT_RGB);       
glutInitWindowPosition (0, 0); 
glutInitWindowSize (500, 500); 
glutCreateWindow ("bangun dasar 4
segitiga");             
init (); 
glutDisplayFunc (Display);  
glutMainLoop (); 
return 0;} | 
8. Setelah diketik pilih Execute dan klik Compile & Run
9.      Setelah
di Compile dan run setelah itu Save File dan Save
10.      Setelah
itu akan keluar output sebagai berikut :










 
 
Dinosaurs, Giant, and More! - TetraVision - Titanium
ReplyDeleteDiscover Dinosaurs, titanium blue Giant, and More! - TetraVision - toaks titanium Titanium. Find complete details of titanium easy flux 125 amp welder Dinosaurs, samsung titanium watch Giant, and More! - TetraVision. titanium white octane blueprint