Contents

조회 수 8755 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
#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();
}


?

  1. [c] scanf(), printf() 포맷의 형변환

  2. [c] RSA 암호화 구현(gmp 라이브러리 활용)

  3. [c] pcap을 이용한 패킷 분석 ㅎㅎ

  4. [c] pcapdump 파일 분석 하는 프로그램.. ㅋㅋ

  5. [c] openssl 샘플코드.. 어려움 ㅠㅠ

  6. [c] OpenGL 직사각형(2D) 크기 확대/축소

  7. [c] OpenGL 임시로 여기 올림..

  8. [c] OpenGL 시어핀스키 가스킷(p.73 - 첫시간)

  9. [c] OpenGL 색 입방체의 회전(입체)

  10. [c] OpenGL 마우스 이벤트

  11. [c] OpenGL 관측점 이동

  12. [c] Mac OS 에 gmp(gmp.h) 라이브러리 설치

Board Pagination Prev 1 ... 49 50 51 52 53 54 55 56 57 58 ... 71 Next
/ 71