X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fscreen.cpp;h=16a3ab8aec29c55f9f059364d9d40faf5bbb4537;hp=46a2b73b4068e66f0c4a77d5547790901f6b2c7f;hb=a8297c3461718f2d9afc7a2f8ca620d320ac5f97;hpb=1d179b93f6a1b2a4fe3823c26fba862c24bc5d6e diff --git a/src/screen.cpp b/src/screen.cpp index 46a2b73..16a3ab8 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -8,12 +8,15 @@ #include "bufferbuilder.h" #include "shaderprogram.h" + + #define BASICTEX_VERT "shaders/basictex_vert.glsl" #define BASICTEX_FRAG "shaders/basictex_frag.glsl" using namespace IPDF; using namespace std; +#ifndef __MINGW32__ static void opengl_debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* msg, const void *data) { // Don't print out gl Errors we generated. @@ -22,7 +25,7 @@ static void opengl_debug_callback(GLenum source, GLenum type, GLuint id, GLenum // Spams this message on fglrx, disabling for now because it's damn annoying. // ERROR: opengl_debug_callback (screen.cpp:21) - OpenGL Error (1011): glObjectLabel failed because (depending on the operation) a referenced binding point is empty; a referenced name is not the name of an object; or the given name is otherwise not valid to this operation (GL_INVALID_VALUE) } - +#endif Screen::Screen(bool visible) { @@ -51,28 +54,30 @@ Screen::Screen(bool visible) ogl_LoadFunctions(); // Why is this so horribly broken? - if (ogl_IsVersionGEQ(3,0)) + if (ogl_IsVersionGEQ(3,2)) { - Error("We require OpenGL 3.1, but you have version %d.%d!",ogl_GetMajorVersion(), ogl_GetMinorVersion()); + Fatal("We require OpenGL 3.3, but you have version %d.%d!",ogl_GetMajorVersion(), ogl_GetMinorVersion()); } if (!SDL_GL_ExtensionSupported("GL_ARB_shading_language_420pack")) { - Error("Your system does not support the ARB_shading_language_420pack extension, which is required."); + Fatal("Your system does not support the ARB_shading_language_420pack extension, which is required."); } if (!SDL_GL_ExtensionSupported("GL_ARB_explicit_attrib_location")) { - Error("Your system does not support the ARB_explicit_attrib_location extension, which is required."); + Fatal("Your system does not support the ARB_explicit_attrib_location extension, which is required."); } m_frame_begin_time = SDL_GetPerformanceCounter(); m_last_frame_time = 0; m_last_frame_gpu_timer = 0; + glGenQueries(1, &m_frame_gpu_timer); glBeginQuery(GL_TIME_ELAPSED, m_frame_gpu_timer); - + #ifndef __MINGW32__ glDebugMessageCallback(opengl_debug_callback, 0); + #endif GLuint default_vao; glGenVertexArrays(1, &default_vao);