#include "boring_parts.hpp" // TODO : only need OpenGL things, not GTK ones for now //#include "gtk_includes.hpp" /* From http://stackoverflow.com/questions/4317062/opengl-how-to-check-if-the-user-supports-glgenbuffers #ifdef WIN32 #include #define glGetProcAddress(a) wglGetProcAddress(a) #endif #ifdef X11 #define glGetProcAddress(a) glXGetProcAddress ( \ reinterpret_cast(a) \ ) #endif #ifndef GetExtension #define GetExtension(Type, ExtenName) \ ExtenName = (Type) \ glGetProcAddress(STRINGIFY(ExtenName)); \ if(!ExtenName) \ { \ std:cout << "Your Computer Does Not " \ << "Support GL Extension: " \ << STRINGIFY(ExtenName) \ << std::endl; \ exit(1); \ } \ else \ { \ std::cout << "Loaded Extension: " \ << STRINGIFY(ExtenName) \ << std::endl; \ } #endif */ bool updateGLProjectionMatrix(Glib::RefPtr glCtx, Glib::RefPtr glWin, int width, int height) { GLdouble aspect = (GLdouble) width/height; // *** OpenGL BEGIN *** if (!glWin->gl_begin(glCtx)) return false; glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0, aspect, 0.1, 10.0); glMatrixMode(GL_MODELVIEW); glWin->gl_end(); // *** OpenGL END *** return true; }