* Visual Studio 6.0 기준으로 설명.
1. 아래 사이트에 들어가서 glut37.zip, glut37data.zip, glutdlls37beta.zip 파일 3개를 다운 받는다.
http://www.opengl.org/resources/libraries/glut/glut_downloads.php
2. 각각 압축을 푼다.
i) glut37.zip
- vs에서 참조할 폴더이므로 경로를 안전한 곳으로 옮긴다.
- D:\glut-3.7
ii) glut37data.zip
- 압축을 풀면 glut-3.7 폴더가 있는데 그 폴더 안에 있는 모든 파일들을 위에서 압축을 푼 glut-3.7 폴더 안에 덮어씌운다.
iii) glutdlls37beta.zip
- glut.lib와 glut32.lib 파일 두 개를 D:\glut-3.7\lib\glut 에 넣는다.
- glut.h 파일은 C:\Program Files\Microsoft Visual Studio\VC98\Include\GL 에 넣는다.
- glut.dll와 glut32.dll 파일 두 개를 C:\Windows\System32 에 넣는다.
3. vs 6.0 옵션에서 아래처럼 설정한다.
- include files
- library files
4. 아래 소스로 컴파일이 되면 제대로 셋팅이 된 것이다.
#include // (or others, depending on the system in use)
void init (void)
{
glClearColor (1.0, 1.0, 1.0, 0.0) ; // Set display-window color to white.
glMatrixMode (GL_PROJECTION); // Set projection parameters.
gluOrtho2D (0.0, 200.0, 0.0, 150.0);
}
void lineSegment (void)
{
glClear (GL_COLOR_BUFFER_BIT); // Clear display window.
glColor3f(1.0, 0.0, 0.0); // Set line segment color to red.
glBegin (GL_LINES);
glVertex2i (180, 15); // Specify line-segment geometry.
glVertex2i (10, 145);
glEnd();
glFlush (); // Process all OpenGL routines as quickly as possible.
}
void main (int argc, char** argv)
{
glutInit (&argc, argv); // Initialize GLUT.
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); // Set display mode.
glutInitWindowPosition (50, 100); // Set top-left display-window position.
glutInitWindowSize (400, 300); // Set display-window width and height.
glutCreateWindow ("An Example OpenGL Program"); // Create display window.
init(); // Execute initialization procedure.
glutDisplayFunc (lineSegment); // Send graphics to display window.
glutMainLoop(); // Display everything and wait.
}
'Study > OpenGL' 카테고리의 다른 글
| 드래그하면서 점선으로 된 사각형 그리기 (0) | 2011.09.15 |
|---|---|
| glLineStipple 선그리기 (0) | 2011.09.15 |
| 다각형 회전하기, 크기 조절하기 (0) | 2011.09.08 |
| 키보드와 마우스 콜백하기 (0) | 2011.09.05 |
| GLUT의 윈도우와 뷰포트하기 (0) | 2011.09.01 |