Contents

조회 수 9812 댓글 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. [ios] Background 에서 네트워크 사용

  2. [linux] X환경 GNOME에서 KDE로 바꾸는 법..

  3. JSON, BSON 변환

  4. [linux] /etc/fstab 설정 방법.. ㅋㅋ

  5. [c++] 현승이가 준 P2P 프로그램 소스 ㅋㅋ

  6. SVN 명령어 (SVN command)

  7. [java] 날짜 계산 (Date, SimpleDateFormat)

  8. [php] 한샘 전자발주 시스템..

  9. [ios] 동영상 플레이어 샘플 (for PIP Player)

  10. [unix] 유닉스 명령에 메타문자 사용

  11. [swift] NotificationCenter 간단 예제

  12. [php] whois정보 조회 프로그램

Board Pagination Prev 1 ... 30 31 32 33 34 35 36 37 38 39 ... 99 Next
/ 99