환경 : ubuntu 13.10 64bit |
install
$ sudo apt-get install mesa-common-dev
$ sudo apt-get install freeglut3-dev
compile
g++ <file name>.cpp -lGL -lGLU -lglut -o a
sample code
#include <gl/freeglut.h>
#include <gl/gl.h>
void renderfunction() {
glclearcolor(0.0, 0.0, 0.0, 0.0);
glclear(gl_color_buffer_bit);
glcolor3f(1.0, 1.0, 1.0);
glortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glbegin(gl_polygon);
glvertex2f(-0.5, -0.5);
glvertex2f(-0.5, 0.5);
glvertex2f(0.5, 0.5);
glvertex2f(0.5, -0.5);
glend();
glflush();
}
int main(int argc, char** argv) {
glutinit(&argc, argv);
glutinitdisplaymode(glut_single);
glutinitwindowsize(500, 500);
glutinitwindowposition(100, 100);
glutcreatewindow("opengl - first window demo");
glutdisplayfunc(renderfunction);
glutmainloop();
return 0;
}
결과 화면
'소프트웨어 > openGL' 카테고리의 다른 글
openGL | openGL 3강-빛(1) (0) | 2014.01.10 |
---|---|
openGL | openGL 2강-화면(2) (0) | 2014.01.10 |
openGL | 1강-화면(1) (0) | 2014.01.10 |
openGL | openGL 0강-설치 (0) | 2014.01.10 |
openGL | 어느 블로그 (0) | 2014.01.10 |