opengl不带输出文字api,可以用glut来实现
void myDisplay(void) { int a = clock(); glClear(GL_COLOR_BUFFER_BIT); char *str = "FPS:60"; int n = strlen(str); glRasterPos3f(-1, 0.95, 0.0); for (int i = 0; i < n; i++) glutBitmapCharacter(GLUT_BITMAP_9_BY_15, *(str + i)); glFlush(); cout << "FPS:" << 1000.0 / (clock() - a) << endl; }
时间: 2024-10-07 11:13:34