Back to the Vavoom Forum Archives


Forum

[Fixed] [SVN 4070] Doesn't build on linux

Wed, 16 Sep 2009 11:30:32

mnk

A minor notice: when adding OpenGL functions, make sure you're adding them in a proper place. Adding Windows-specific functions to a generic OpenGL file is a mistake, gl_main.cpp was meant to be generic. Here is what I did to make it build (obviously, it's incorrect, as both versions should go to their proper files): - first, I added '#include <GL/glx.h>' - then, I changed the new VSync block into this:
if (CheckExtension("GLX_SGI_swap_control"))
{
    GCon->Log(NAME_Init, "Swap control extension found.");
    typedef int (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);

    PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;

    wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)glXGetProcAddressARB((const GLubyte *)"glXSwapIntervalSGI");

    if( wglSwapIntervalEXT )
        wglSwapIntervalEXT(r_vsync);
}
I'm not sure, this code is correct, as this was created mainly by google, but it has a good chance to be, except perhaps for CheckExtension part, as it does glGetString(GL_EXTENSIONS) and GLX_SGI_swap_control obviously is not one (perhaps use glXQueryExtensionsString in such case - I've checked and it seems it does find the extension that way). Looks, like in SDL this would be handled by SDL_GL_SetAttribute with SDL_GL_SWAP_CONTROL - better than adding glXQueryExtensionsString stuff. PS: having reread a few pages, I'm almost sure that the correct way would be removing that block completely from gl_main.cpp, adding SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, r_vsync) in gl_sdl.cpp and doing whatever in one of the windows only files.
Fri, 18 Sep 2009 16:08:45

Firebrand

Hopefully fixed.

Back to the Vavoom Forum Archives