Simple way to display texts inside openGL 3d/2d world

Submitted by techrev on Sun, 01/14/2018 - 11:20
Forums

    glRasterPos2i(0, 0);
    std::string s = "Some text";
    void * font = GLUT_BITMAP_9_BY_15;

    for (std::string::iterator i = s.begin(); i != s.end(); ++i)
    {
        char c = *i;
        glutBitmapCharacter(font, c);
    }
    glEnable(GL_TEXTURE_2D);