Contents

조회 수 8761 댓글 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] 지나가는 패킷 잡기

  2. [mysql] 쿼리 실행시 ERROR 1366 (HY000) : incorrect string value : for column

  3. [c++] mfc 이용한 트레이아이콘(TrayIcon) 클래스 예제 프로젝트

  4. [c] 함수 요약 (검색해서 쓰세요..)

  5. [c++] 레지스트리 등록 예제

  6. [c] 압축 알고리즘 소스 및 정리

  7. [java] 채팅창 처럼.. swing..

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

  9. [c++] 중복실행 방지(Mutex;뮤텍스 ) 샘플 소스.. ㅋㅋ

  10. [linux] man 명령어 뽀개기..

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

  12. [c] 캘린더 양음 변환 함수

Board Pagination Prev 1 ... 41 42 43 44 45 46 47 48 49 50 ... 98 Next
/ 98