#include #include #include #include #include "example.h" #include "helper.h" static int windowId; static int screenw, screenh; static void Resize(int width, int height) { screenw = width; screenh = height; glViewport(0, 0, screenw, screenh); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, screenw, screenh, 0, -10, 10); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } static void Render(void) { try { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (!exampleRender(screenw, screenh)) { glutDestroyWindow(windowId); return; } glutSwapBuffers(); } catch(const std::exception& ex) { std::cout << "Exception: " << ex.what() << std::endl; glutDestroyWindow(windowId); } } int main(int argc, char** argv) { try { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowSize(640, 480); windowId = glutCreateWindow("libTextSuite example"); glClearColor(1.0, 1.0, 1.0, 1.0); if (!exampleInit()) return 1; glutReshapeFunc(Resize); glutDisplayFunc(Render); glutMainLoop(); exampleFinish(); } catch(const std::exception& ex) { std::cout << "Exception: " << ex.what() << std::endl; } }