Develop
2003.04.23 10:45
[c] OpenGL 시어핀스키 가스킷(p.73 - 첫시간)
조회 수 8758 댓글 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();
}
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
1041 | Develop | [ios] FlckrFeed Example App (Swift) | hooni | 2016.11.27 | 1081 |
1040 | System/OS | Enable the Develop Menu in Safari | hooni | 2017.02.07 | 1081 |
1039 | PPT | [ppt] 정보보호관리 발표내용 | hooni | 2016.11.30 | 1084 |
1038 | Develop | [js] 문자열에서 숫자만 걸러내기 (jQuery 안쓰고 정규표현식) | hooni | 2017.12.14 | 1110 |
1037 | Develop | [maven] Mac OS에 메이븐(maven) 설치하기 | hooni | 2015.01.21 | 1112 |
1036 | Etc | 원어민이 매일 쓰는 일상표현 150개 | hooni | 2023.09.17 | 1113 |
1035 | Develop | [ios] UIView 계층구조 | hooni | 2015.01.03 | 1130 |
1034 | Etc | 영어. 반드시 외워야 할 문장 패턴 100개 | hooni | 2023.06.08 | 1133 |
1033 | Develop | GPL, AGPL, MPL,.. 한눈에 보는 오픈소스SW 라이선스 | hooni | 2014.10.14 | 1146 |
1032 | Develop | [coding] Find all anagrams in a string | hooni | 2017.06.27 | 1148 |
1031 | Develop | macOS에 node, npm 설치하기 (homebrew) | hooni | 2021.11.06 | 1151 |
1030 | System/OS | Enable Safari Hidden Debug Menu in Mac OS X | hooni | 2017.02.07 | 1155 |