Skip to content

Commit

Permalink
Windows|Fixed|libgui: Initial GLInfo and entrypoints setup
Browse files Browse the repository at this point in the history
First get entrypoints, then query extensions.
  • Loading branch information
skyjake committed Dec 7, 2013
1 parent 1157709 commit 0a9016a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions doomsday/libgui/src/canvas.cpp
Expand Up @@ -302,11 +302,10 @@ void Canvas::initializeGL()
LOG_AS("Canvas");
LOG_DEBUG("Notifying GL init (during paint)");

GLInfo::glInit();

#ifdef LIBGUI_USE_GLENTRYPOINTS
getAllOpenGLEntryPoints();
#endif
GLInfo::glInit();

DENG2_FOR_AUDIENCE(GLInit, i) i->canvasGLInit(*this);
}
Expand Down Expand Up @@ -342,6 +341,7 @@ void Canvas::showEvent(QShowEvent* ev)
makeCurrent();
getAllOpenGLEntryPoints();
#endif
GLInfo::glInit();
QTimer::singleShot(1, this, SLOT(notifyReady()));
}
}
Expand Down
17 changes: 6 additions & 11 deletions doomsday/libgui/src/glentrypoints.cpp
Expand Up @@ -108,11 +108,13 @@ void getAllOpenGLEntryPoints()
if(haveProcs) return;

#ifdef WIN32
# define GET_PROC(name) *((void**)&name) = wglGetProcAddress(#name); DENG2_ASSERT(name != 0)
# define GET_PROC_EXT(name) *((void**)&name) = wglGetProcAddress(#name)
#else
# define GET_PROC(name) *((void (**)())&name) = glXGetProcAddress((GLubyte const *)#name); DENG2_ASSERT(name != 0)
# define GET_PROC_EXT(name) *((void (**)())&name) = glXGetProcAddress((GLubyte const *)#name)
#endif

#define GET_PROC(name) GET_PROC_EXT(name); DENG2_ASSERT(name != 0) // must have

//LOG_AS("getAllOpenGLEntryPoints");
//LOG_VERBOSE("GL_VERSION: ") << (char const *) glGetString(GL_VERSION);

Expand Down Expand Up @@ -174,15 +176,8 @@ void getAllOpenGLEntryPoints()
GET_PROC(glUseProgram);
GET_PROC(glVertexAttribPointer);

if(GLInfo::extensions().EXT_framebuffer_blit)
{
GET_PROC(glBlitFramebufferEXT);
}

if(GLInfo::extensions().EXT_framebuffer_multisample)
{
GET_PROC(glRenderbufferStorageMultisampleEXT);
}
GET_PROC_EXT(glBlitFramebufferEXT);
GET_PROC_EXT(glRenderbufferStorageMultisampleEXT);

haveProcs = true;
}
Expand Down
2 changes: 2 additions & 0 deletions doomsday/libgui/src/glinfo.cpp
Expand Up @@ -99,6 +99,8 @@ DENG2_PIMPL_NOREF(GLInfo)

void init()
{
if(inited) return;

// Extensions.
ext.ARB_texture_env_combine = query("GL_ARB_texture_env_combine") || query("GL_EXT_texture_env_combine");
ext.ARB_texture_non_power_of_two = query("GL_ARB_texture_non_power_of_two");
Expand Down

0 comments on commit 0a9016a

Please sign in to comment.