3차원 가스킷
#include #include #include #include #include "glut.h" GLfloat v[4][3]={{0.0, 0.0, 1.0}, {0.0, 0.942809, -0.33333}, {-0.816497, -0.471405, -0.333333}, {0.816497, -0.471405, -0.333333}}; GLfloat colors[4][3] = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, 0.0}}; int n; void myinit(void) { /* 속성들 */ glClearColor(1, 1, 1, 1); glColor3f(1.0, 1.0, 1.0); glEnable( GL_DEPTH_TEST ); /* 관..
2010. 3. 17.
2차원 가스킷
#include GLfloat v[3][2]={{-1.0, -0.58}, {1.0, -0.58}, {0.0, 1.15}}; int n=5; void triangle(GLfloat *a, GLfloat *b, GLfloat *c) { glBegin(GL_TRIANGLES); glVertex2fv(a); glVertex2fv(b); glVertex2fv(c); glEnd(); } void divide_triangle(GLfloat *a, GLfloat *b, GLfloat *c, int k) { GLfloat ab[2], ac[2], bc[2]; int j; if(k>0) { /* 변의중점계산*/ for(j=0; j
2010. 3. 17.
가스킷 그리기
#include #include #include void myinit(void) { /* 속성들 */ glClearColor(1.0, 1.0, 1.0, 1.0); /* 흰 배경 */ glColor3f(1.0, 0.0, 0.0); /* 적색으로 그림 */ /* 관측의 설정 */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, 50.0, 0.0, 50.0); glMatrixMode(GL_MODELVIEW); } void display(void) { GLfloat vertices[3][2] = {{0.0, 0.0}, {25.0, 50.0}, {50.0, 0.0}}; /* 삼각형 */ int i, j, k; //int rand(); /* 표준 난수..
2010. 3. 11.