홈
태그
미디어로그
위치로그
방명록
Angler Blog
(115)
일상생활_리뷰
(1)
UnrealEngine
(3)
ROS
(3)
Network
(5)
GamePrograming
(35)
Create Game
(9)
Direct3D
(14)
OpenGL
(4)
Orge Engine
(4)
내가본 GPG_One
(4)
랭귀지
(20)
C\C++
(5)
API
(4)
MFC
(7)
OpenMP
(4)
KAU
(38)
운영체제
(4)
Linux
(34)
iOS
(1)
언어정리
(4)
휴양
(0)
ABOUT ME
-
트위터
인스타그램
Today
-
Yesterday
-
Total
-
Angler
Angler
메뉴
검색
컨텐츠 검색
숙명 - OpenGL
카테고리 없음
2011. 10. 6. 11:59
#include <gl/glut.h> #include <gl/gl.h> #include <gl/glu.h> void MyDisplay() { glClear(GL_COLOR_BUFFER_BIT); glViewport(0, 0, 300, 300); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f(1.0f, 0, 0); glutSolidCube(0.3f); glRotatef(45.0f, 0, 0, 1.0f); glTranslatef(0.6f, 0, 0); glColor3f(1.0f, 1.0f, 0); glutSolidCube(0.3f); glViewport(300, 0, 300, 300); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f(1.0f, 0, 0); glutSolidCube(0.3f); glTranslatef(0.6f, 0, 0); glRotatef(45.0f, 0, 0, 1.0f); glColor3f(1.0f, 1.0f, 0); glutSolidCube(0.3f); glFlush(); } void MyKeyboard(unsigned char KeyPressed, int X, int Y) { switch(KeyPressed){ case 27: exit(0); break; } glutPostRedisplay( ); } int main() { glutInitWindowSize(600, 300); glutCreateWindow("Draw Name OpenGL"); glutDisplayFunc(MyDisplay); glutKeyboardFunc(MyKeyboard); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glutMainLoop(); return 0; }
#include <gl/glut.h> #include <gl/gl.h> #include <gl/glu.h> bool wire = true; void MyDisplay() { glClear(GL_COLOR_BUFFER_BIT); glViewport(0, 0, 600, 600); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //몸통 glColor3f(0.2f, 0.9f, 0.1f); glScalef(1.0f, 1.5f, 1.0f); if(!wire) glutSolidCube(0.5f); else glutWireCube(0.5f); //얼굴 glColor3f(0.9f, 0.8f, 0.0f); glLoadIdentity(); glTranslatef(0, 0.58f, 0); if(!wire) glutSolidSphere(0.2f, 20, 20); else glutWireSphere(0.2f, 20, 20); //팔왼쪽 glColor3f(0.5f, 0.0f, 0.5f); glLoadIdentity(); glTranslatef(-0.5f, 0.25f, 0); glScalef(2.5f, 1.0f, 1.0f); if(!wire) glutSolidCube(0.2f); else glutWireCube(0.2f); //왼쪽주먹 glColor3f(0.1f, 0.5f, 0.7f); glLoadIdentity(); glTranslatef(-0.85f, 0.25f, 0); if(!wire) glutSolidSphere(0.1f, 20, 20); else glutWireSphere(0.1f, 20, 20); //팔오른쪽 glColor3f(0.5f, 0.0f, 0.5f); glLoadIdentity(); glTranslatef(0.5f, 0.25f, 0); glScalef(2.5f, 1.0f, 1.0f); if(!wire) glutSolidCube(0.2f); else glutWireCube(0.2f); //오른쪽주먹 glColor3f(0.1f, 0.5f, 0.7f); glLoadIdentity(); glTranslatef(0.85f, 0.25f, 0); if(!wire) glutSolidSphere(0.1f, 20, 20); else glutWireSphere(0.1f, 20, 20); //왼쪽다리 glColor3f(0.5f, 0.0f, 0.5f); glLoadIdentity(); glTranslatef(-0.15f, -0.525f, 0); glScalef(1.0f, 1.5f, 1.0f); if(!wire) glutSolidCube(0.2f); else glutWireCube(0.2f); //왼쪽발 glColor3f(0.1f, 0.5f, 0.7f); glLoadIdentity(); glTranslatef(-0.25f, -0.775f, 0); glScalef(2.0f, 1.0f, 1.0f); if(!wire) glutSolidCube(0.2f); else glutWireCube(0.2f); //오른쪽다리 glColor3f(0.5f, 0.0f, 0.5f); glLoadIdentity(); glTranslatef(0.15f, -0.525f, 0); glScalef(1.0f, 1.5f, 1.0f); if(!wire) glutSolidCube(0.2f); else glutWireCube(0.2f); //오른쪽발 glColor3f(0.1f, 0.5f, 0.7f); glLoadIdentity(); glTranslatef(0.25f, -0.775f, 0); glScalef(2.0f, 1.0f, 1.0f); if(!wire) glutSolidCube(0.2f); else glutWireCube(0.2f); glFlush(); } void MyKeyboard(unsigned char KeyPressed, int X, int Y) { switch(KeyPressed){ case 'W': case 'w': wire =!wire; break; case 27: exit(0); break; } glutPostRedisplay( ); } int main() { glutInitWindowSize(600, 600); glutCreateWindow("Draw Name OpenGL"); glutDisplayFunc(MyDisplay); glutKeyboardFunc(MyKeyboard); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glutMainLoop(); return 0; }
공유하기
게시글 관리
Angler
댓글
댓글 접기
댓글 펼치기
티스토리툴바