/ / 最新

swk's log - OpenGL sort

2011-05-21

* OpenGL sort [tech]

こうですか!? わかりません><

#include <GL/glut.h>

void
drawnum(int n)
{
    glPushMatrix();
    glTranslated(0, 0, n / 100.0);
    glScaled(0.0005, 0.0005, 0.0005);
    do {
        glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, "0123456789"[n % 10]);
        glTranslated(-200, 0, 0);
    } while ((n /= 10) > 0);
    glPopMatrix();
}

void
display()
{
    int i;
    int d[] = { 52, 23, 132, 5, 98 };
    
    glClear(GL_COLOR_BUFFER_BIT);
    for (i = 0; i < sizeof(d) / sizeof(d[0]); i++) {
        drawnum(d[i]);
    }
    glFlush();
}

int
main(int argc, char *argv[])
{
    glutInitWindowSize(640, 480);
    glutInit(&argc, argv);
    glutCreateWindow("OpenGL Sort");

    glMatrixMode(GL_PROJECTION);
    gluPerspective(60, 1, 0.5, 1000);
    glMatrixMode(GL_MODELVIEW);
    gluLookAt(-1, 1, 2, 0, 0, 0, 0, 1, 0);
    
    glutDisplayFunc(display);
    glutMainLoop();
    /* NOTREACHED */
}

glsort/glsort.png

[ コメントを全部見る / コメントを書く] [ TrackBack ( )] [固定リンク]

* [Robbiecoeve] Шалом! Смотрите что достал: https... (2019-02-22 05:14:50)

* [nukhWouff] canada online pharmacy http... (2019-02-16 20:59:06)

* [gnjuAniTA] online pharmacy school http... (2019-02-16 17:52:43)

* [dfbjbromy] precription drugs from canada http... (2019-02-16 11:13:21)

* [bsfGrall] canada online pharmacy http... (2019-02-16 10:35:27)

* ...

最終更新時間: 2011-06-19 02:04


Shingo W. Kagami - swk(at)kagami.org