前の日 / 次の日 / 最新

swk's log

2011-05-21 Sat

* 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 ( )] [固定リンク]

* [RobertFub] [url=http://buyprednisonexxx.com/]buy pr... (2017-06-21 07:35:48)

* [RonaldLut] [url=http://buypropeciaxxx.com/]buy gene... (2017-06-21 07:31:58)

* [RobertOccak] [url=http://buylevitrasxf.com/]buy levit... (2017-06-20 03:21:36)

* [Justinuring] ustinuring http://g-pen-elite.ru/ Justin... (2017-06-16 05:50:59)

* [Gregoryhougs] [url=http://wheretobuymotilium.org/]buy ... (2017-06-15 18:30:57)

* ...

<< 2011-05 >>
SuMoTuWeThFrSa
1234567
891011121314
15161718192021
22232425262728
293031

2012 : 01 02 03 04 05 06 07 08 09 10 11 12
2011 : 01 02 03 04 05 06 07 08 09 10 11 12
2010 : 01 02 03 04 05 06 07 08 09 10 11 12
2009 : 01 02 03 04 05 06 07 08 09 10 11 12
2008 : 01 02 03 04 05 06 07 08 09 10 11 12
2007 : 01 02 03 04 05 06 07 08 09 10 11 12
2006 : 01 02 03 04 05 06 07 08 09 10 11 12
2005 : 01 02 03 04 05 06 07 08 09 10 11 12
2004 : 01 02 03 04 05 06 07 08 09 10 11 12
2003 : 01 02 03 04 05 06 07 08 09 10 11 12
2002 : 01 02 03 04 05 06 07 08 09 10 11 12
2001 : 01 02 03 04 05 06 07 08 09 10 11 12
2000 : 01 02 03 04 05 06 07 08 09 10 11 12
1999 : 01 02 03 04 05 06 07 08 09 10 11 12
1998 : 01 02 03 04 05 06 07 08 09 10 11 12
1997 : 01 02 03 04 05 06 07 08 09 10 11 12
1996 : 01 02 03 04 05 06 07 08 09 10 11 12

最終更新時間: 2012-02-13 02:02


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