glutStrokeCharacter() flipped text

I want to make a very simple OpenGL application (using freeglut) that just puts text on the screen. However, the Text is flipped (x-axis):

image

static char *string = "Hello World!\nHi";
void draw(void);

int main(int argc, char **argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("hello!");
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0f, WIN_WIDTH, WIN_HEIGHT, 0.0f, 0.0f, 1.0f);
    glutDisplayFunc(&draw);
    glutMainLoop();
    return(0);
}

void draw(void) {

    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
    for (char* p = string; *p; p++)
        glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, *p);
    glPopMatrix();
    glFlush();
}


from Recent Questions - Stack Overflow https://ift.tt/3Ckqhka
https://ift.tt/3AfISfj

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)