-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstGraphics.cpp
More file actions
37 lines (34 loc) · 1.03 KB
/
firstGraphics.cpp
File metadata and controls
37 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <windows.h>
#include <gl/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
<<<<<<< HEAD
=======
glShadeModel(GL_FLAT);
>>>>>>> bd0c77f16207c5c88f0d98801ae2016f211281c3
glColor3f(0.0, 0.0, 1.0);
gluLookAt(1.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); // 변수가 9개나 들어간다..
glScalef(1.0, 2.0, 1.0);
glutWireTeapot(3.0);
glFlush(); // 함수 명령어를 일일이 쌓지 않고 queue에 저장된 명령어 하나하나를 즉시 수행
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
glMatrixMode(GL_MODELVIEW);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(800, 400);
glutCreateWindow("OpenGL을 공부하기 위한 티팟 샘플!");
glClearColor(1.0, 1.0, 1.0, 1.0);
glutDisplayFunc(display); // display 메서드 호출
glutReshapeFunc(reshape); // reshape 메서드 호출
glutMainLoop();
return 0;
}