Develop
2003.04.23 10:45
[c] OpenGL 시어핀스키 가스킷(p.73 - 첫시간)
조회 수 8756 댓글 0
#include<GL/glut.h>
void myinit(void);
void display(void);
void main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(0, 0);
glutCreateWindow("Simple OpenGL example");
glutDisplayFunc(display);
myinit();
glutMainLoop();
}
void myinit(void)
{
glClearColor(1.0, 1.0, 1.0, 0.0);
glColor3f(1.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 500.0, 0.0, 500.0);
glMatrixMode(GL_MODELVIEW);
}
void display(void)
{
typedef GLfloat point2[2];
point2 vertices[3] = { {0.0, 0.0}, {250.0, 500.0}, {500.0, 0.0} };
int i, j, k;
int rand();
point2 p = {75.0, 50.0};
glClear(GL_COLOR_BUFFER_BIT);
for(k=0; k<500; k++)
{
j = (rand()) % 3;
p[0] = (p[0]+vertices[j][0])/2.0;
p[1] = (p[1]+vertices[j][1])/2.0;
glBegin(GL_POINTS);
glVertex2fv(p);
glEnd();
}
glFlush();
}
-
[php] 정규표현식 간단히 정리
-
[linux] 콘솔 기본언어 설정 방법
-
[js] selectbox 선택 후 input 박스에 적용
-
[ajax] 이벤트 코드 생성기 작업중.. ㅋㅋ
-
[sql] 중복데이터 삭제 쿼리
-
[sql] 조회구문(select)에서 중복 데이터를 한 번만 출력 (distinct)
-
[php] 날짜 정보 출력 (년,월,일,시,분,초)
-
[c] KNN(K-nearest neighbor) 패턴인식 과제..
-
[c] 베이지언(Bayesian) 패턴인식 과제 ㅋㅋ
-
[js] php의 number_format() 함수와 같은.. ㅋㅋ
-
[c] 숫자 맞추는 게임..
-
[c] 구조체 배열 예제 (학생 성적 계산)