EXIF Viewer사진 크기890x356
#include<opengl.h>
float x=0,y=0,x_step=1,y_step=1,rec=25,Windowheight=100,WindowWidth=100;
void Renderscene (void){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1, 0, 0);
glRectf(x,y,x+rec,y-rec);
glutSwapBuffers();
}
void Setuprc(void) {
glClearColor(1, 1, 0, 1);
}
void Changesize(int w, int h){
GLfloat aspectratio=(GLfloat)
w/ (GLfloat) h;
//if(h==0) h=1;
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(w<=h)
glOrtho(-100, 100, -100/aspectratio,
100/aspectratio, -1, 1);
else
glOrtho(-100*aspectratio,
100*aspectratio, -100, 100, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void Timerfunction (int value){
if(x> WindowWidth-rec ||
x< -WindowWidth) x_step=-x_step;
if(y> Windowheight || y<
-Windowheight+rec) y_step=-y_step;
x += x_step;
y +=
y_step;
glutPostRedisplay();
glutTimerFunc(100,Timerfunction,1);
}
void main (void){
glutInitDisplayMode(GL_DOUBLE |
GLUT_RGB);
glutCreateWindow("Main");
glutDisplayFunc(Renderscene);
glutReshapeFunc(Changesize);
glutTimerFunc(100,Timerfunction,1);
Setuprc();
glutMainLoop();
}
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
8 |
[OpenGL] OpenGL 표현에 필요한 파일들...
![]() | simpled | 2013.09.22 | 3090 |
7 |
[C :: OpenGL] 곡선
![]() | simpled | 2013.08.05 | 4347 |
6 |
[C :: OpenGL] 프로젝션을 사용하지 않은 그림자 생성
![]() | simpled | 2013.08.05 | 6536 |
5 |
[C :: OpenGL] 2D 프로젝션 코드 (그림자 생성 원리)
![]() | 심플디 | 2013.08.05 | 8205 |
4 |
[C :: OpenGL] 삼각형 그리기
![]() | simpled | 2013.08.05 | 3915 |
3 |
[C :: OpenGL] cosin^n (Θ)의 3D 그래프
![]() | 심플디 | 2013.08.05 | 3224 |
» |
[C :: OpenGL] 움직이는 4각형 :: OpenGL
![]() | simpled | 2013.08.05 | 3723 |
1 |
[C :: OpenGL] OpenGL utility toolkit. zip
![]() | simpled | 2013.08.05 | 3456 |