Contents

Views 8789 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
#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();
}


?

List of Articles
No. Category Subject Author Date Views
73 Develop [ppt] iOS 플라랩#04(2015.06.19) 발표 자료 file hooni 2015.06.04 773
72 Develop [python] DJI Tello 드론 코딩 (프로그래밍) 58 file hooni 2018.03.04 28258
71 Develop [python] 애니팡, 캔디팡 매크로 file hooni 2013.09.06 18039
70 Develop [python] 파라미터 앞에 *, ** 의 의미? (*args, **kwargs) hooni 2019.11.22 1700
69 Develop [python] 파이썬 공부하는 사이트~ hooni 2013.11.12 10892
68 Develop [python][django] request.cookie 읽어오기 ㅋㅋㅋ (쓰기) hooni 2019.12.06 1834
67 Develop [sh] html 안에 있는 img 다운 받는 쉘 스크립트 file hooni 2020.05.26 763
66 Develop [sh] 쉘스크립트 if 비교 연산 hooni 2020.05.26 61000
65 Develop [spring] 스프링 IoC/DI hooni 2013.04.23 11410
64 Develop [swift] NotificationCenter 간단 예제 file hooni 2021.01.27 8348
63 Develop [swift] popToRoot 모달뷰, 네비게이션컨트롤러 한꺼번에 닫기 file hooni 2021.01.29 1603
62 Develop [swift] UIView에서 subview 찾기 hooni 2022.12.09 2097
Board Pagination Prev 1 ... 60 61 62 63 64 65 66 67 68 69 ... 71 Next
/ 71