Advertisement
Kojima0502

opneGL_vbo_triangles

Dec 17th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.83 KB | None | 0 0
  1. #include <GLUT/glut.h>
  2.  
  3. void display (void)
  4. {
  5.     glClear(GL_COLOR_BUFFER_BIT);//カラーバッファロをクリア
  6.    
  7.     glBegin(GL_TRIANGLES);
  8.     glColor3f(1.f,0.f,0.f);//赤
  9.     glVertex2f(0.f,0.5f);
  10.    
  11.     glColor3f(0.f,1.f,0.f);//緑
  12.     glVertex2f(-0.5f,-0.5f);
  13.    
  14.     glColor3f(0.f,0.f,1.f);//赤
  15.     glVertex2f(0.5f,-0.5f);
  16.  
  17.     glEnd();
  18.     glFlush();//命令の実行
  19.    
  20. }
  21.  
  22. int main(int argc, char *argv[])
  23. {
  24.  
  25.     glutInit(&argc,argv);
  26.    
  27.     glutInitWindowSize(400,400);
  28.     glutInitDisplayMode(GLUT_RGBA);//ディスプレイモード
  29.     glutCreateWindow("Draw Triangles");
  30.    
  31.     glutDisplayFunc(display);//コールバック関数登録
  32.    
  33.     //カラー・バッファロの初期値//
  34.     glClearColor(1.f, 1.f, 1.f, 1.f);
  35.    
  36.     glutMainLoop();
  37.    
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement