'개소리 왈왈' 카테고리의 다른 글
| 쉼표 (6) | 2011.04.03 |
|---|---|
| 500ml 중 1회 분량 200ml (0) | 2011.04.02 |
| 오오 폐건전지를 이래서 수거하는 거였군! (4) | 2011.03.27 |
| 내 눈깔 (2) | 2011.03.21 |
| 허스키 익스프레스 서비스 종료 (0) | 2011.03.21 |
| 쉼표 (6) | 2011.04.03 |
|---|---|
| 500ml 중 1회 분량 200ml (0) | 2011.04.02 |
| 오오 폐건전지를 이래서 수거하는 거였군! (4) | 2011.03.27 |
| 내 눈깔 (2) | 2011.03.21 |
| 허스키 익스프레스 서비스 종료 (0) | 2011.03.21 |
| void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
GLdouble nearVal, GLdouble farVal);
glFrustum describes a perspective matrix that produces a perspective projection. [링크 : http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml] |
| glutReshapeWindow() 는 크기 변화가 없으면 안그려 OTL (2) | 2011.04.24 |
|---|---|
| glViewport (0) | 2011.04.05 |
| openGL tutorial - 태양과 지구 돌리기 (0) | 2011.03.29 |
| openGL callback function - GLUT 키보드 / 마우스 입력 (0) | 2011.03.28 |
| freeglut (0) | 2011.03.26 |
#include "windows.h"
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glut.h"
static int year = 0, day = 0;
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glPushMatrix();
glutWireSphere(1.0, 20, 16); /* draw sun */
glRotatef((GLfloat) year, 0.0, 1.0, 0.0);
glTranslatef(2.0, 0.0, 0.0);
glRotatef((GLfloat) day, 0.0, 1.0, 0.0);
glutWireSphere(0.2, 10, 8); /* draw smaller planet */
glPopMatrix();
glutSwapBuffers();
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0);
glMatrixMode(GL_MODELVIEW); //GL_PROJECTION
glLoadIdentity();
gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
}
void keyboard(unsigned char key, int x, int y)
{
switch (key)
{
case 'd':
day = (day + 10) % 360;
glutPostRedisplay();
break;
case 'D':
day = (day - 10) % 360;
glutPostRedisplay();
break;
case 'y':
year = (year + 5) % 360;
glutPostRedisplay();
break;
case 'Y':
year = (year - 5) % 360;
glutPostRedisplay();
break;
default:
break;
}
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow(argv[0]);
glClearColor(0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT); //GL_SMOOTH
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}
| void glMatrixMode(GLenum mode);
GL_MODELVIEW Applies subsequent matrix operations to the modelview matrix stack.
GL_PROJECTION Applies subsequent matrix operations to the projection matrix stack.
GL_TEXTURE Applies subsequent matrix operations to the texture matrix stack.
GL_COLOR Applies subsequent matrix operations to the color matrix stack.
void glShadeModel(GLenum mode);
GL_FLAT Smooth shading causes the computed colors of vertices to be interpolated as the primitive is rasterized, typically assigning different colors to each resulting pixel fragment.
GL_SMOOTH Flat shading selects the computed color of just one vertex and assigns it to all the pixel fragments generated by rasterizing a single primitive.
void glPushMatrix(void);
void glPopMatrix(void);
void glTranslated(GLdouble x, GLdouble y, GLdouble z);
void glTranslatef(GLfloat x, GLfloat y, GLfloat z);
void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
void glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
void gluLookAt(GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ,
GLdouble centerX, GLdouble centerY, GLdouble centerZ,
GLdouble upX, GLdouble upY, GLdouble upZ);
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glRotate.xml] glRotate [링크 : http://www.opengl.org/sdk/docs/man/xhtml/glShadeModel.xml] glShadeModel [링크 : http://www.opengl.org/sdk/docs/man/xhtml/glPushMatrix.xml] glPushMatrix / glPopMatrix [링크 : http://www.opengl.org/sdk/docs/man/xhtml/glMatrixMode.xml] glMatrixMode [링크 : http://www.opengl.org/sdk/docs/man/xhtml/gluPerspective.xml] gluPerspective [링크 : http://www.opengl.org/sdk/docs/man/xhtml/gluLookAt.xml] gluLookAt [링크 : http://www.opengl.org/documentation/specs/glut/spec3/node81.html] glutWireSphere |
| glViewport (0) | 2011.04.05 |
|---|---|
| glFrustum - 절두체 (6) | 2011.03.30 |
| openGL callback function - GLUT 키보드 / 마우스 입력 (0) | 2011.03.28 |
| freeglut (0) | 2011.03.26 |
| openGL - glbegin() (2) | 2011.03.25 |
| 군필에 대한 잡설그 (2) | 2011.04.11 |
|---|---|
| 방사선 비가 보슬보슬 내린다고? (2) | 2011.04.06 |
| 스마트폰에도 천지인 쓰자고? (2) | 2011.03.18 |
| 다행히 신은 지구를 버리지 않은걸까? (0) | 2011.03.16 |
| 일본원전 괜찮을까? (4) | 2011.03.12 |
| glutKeyboardFunc(void (*func)(unsigned char key, int x, int y))
sets key processing routine
x and y are mouse coordinates when the key 'key' was pressed
see glutGetModifiers for state of modifier keys (eg. ctrl,...)
glutSpecialFunc(void (*func)(int key, int x, int y));
glutMouseFunc(void (*func)(int button, int state, int x, int y))
mouse function callback
button: GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, GLUT_RIGHT_BUTTON
state: GLUT_UP, GLUT_DOWN
x, y: mouse coordinates |
| glFrustum - 절두체 (6) | 2011.03.30 |
|---|---|
| openGL tutorial - 태양과 지구 돌리기 (0) | 2011.03.29 |
| freeglut (0) | 2011.03.26 |
| openGL - glbegin() (2) | 2011.03.25 |
| openGL - glortho() (4) | 2011.03.25 |
| 만우절에 회식공지라... (0) | 2011.04.01 |
|---|---|
| 삼성 센스 R540 키로거 주의 라는데.... (4) | 2011.03.31 |
| 오랫만에 쓰는 하루늦은 퇴근일기 - 20110323 (4) | 2011.03.23 |
| 동양종금 CMA 금리변동 공지 (0) | 2011.03.22 |
| 아이패드 카트라이더 (8) | 2011.03.17 |
| KF-21 초도비행 성공! (0) | 2022.07.19 |
|---|---|
| 비행기에 120kg 단말기를 감당할 수 없어?! (2) | 2017.10.14 |
| 엌ㅋㅋ V-22 얼짱각도가 중요했군? (2) | 2017.07.05 |
| 500ml 중 1회 분량 200ml (0) | 2011.04.02 |
|---|---|
| sqlgate 라이센스 1개 주는 설문 이벤트! (0) | 2011.03.30 |
| 내 눈깔 (2) | 2011.03.21 |
| 허스키 익스프레스 서비스 종료 (0) | 2011.03.21 |
| 지름신 카테고리를 하나 만들까 -_- (8) | 2011.03.20 |
VERSION:
Release 3.7, Novermber 22, 1998. |
| openGL tutorial - 태양과 지구 돌리기 (0) | 2011.03.29 |
|---|---|
| openGL callback function - GLUT 키보드 / 마우스 입력 (0) | 2011.03.28 |
| openGL - glbegin() (2) | 2011.03.25 |
| openGL - glortho() (4) | 2011.03.25 |
| visual Studio에서 openGL 돌리기 (0) | 2011.03.16 |
The Red Book 중 포함된 파일
| openGL callback function - GLUT 키보드 / 마우스 입력 (0) | 2011.03.28 |
|---|---|
| freeglut (0) | 2011.03.26 |
| openGL - glortho() (4) | 2011.03.25 |
| visual Studio에서 openGL 돌리기 (0) | 2011.03.16 |
| 윈도우에서 opengl.dll을 찾을 수 없다고 할 경우 (0) | 2011.03.15 |