Anyone know how to use C++/OpenGL/XWindows to create multiple windows (multithreading

Discussion in 'Mac Programming' started by bigfoot811, Aug 24, 2009.

  1. bigfoot811 macrumors newbie

    Aug 24, 2009
    I am trying to create a multithreaded (multiple windows) program using OpenGL 2.1 (with shaders). I do not want to use Glut because it is too high level and does not allow me control of events for multiple windows.

    My difficulty is that when I created a project with OpenGL and XWindows - it worked fine with the OpenGL 1.2 calls, but when I tried to use the 2.1 OpenGL extensions, it failed.

    For example, when I used the glCreateProgram method for creating a shader program, my app compiled fine and even linked fine - but at run time the method returned a 0 rather than a program handle.

    Does anyone have any experience with using OpenGL 2.1 with XWindows?

  2. pilotError macrumors 68020


    Apr 12, 2006
    Long Island
    Does your video card support the 2.1 extensions?

    There's an OpenGL utility that will test your video to see if your card supports those calls.

    I think Xbench might do it as well...
  3. oldio macrumors newbie

    Mar 30, 2008
    Montreal, Canada
    GLEW = GL Extention Wrangler has two small executables that tell you exactly what GL extensions are available to you. Might be a good idea to run it and see the results.
  4. bigfoot811 thread starter macrumors newbie

    Aug 24, 2009
    Yes, my video card has support for OpenGL 2+
    I have been running a test app using shaders (and glut) just fine (using glut).
    The problem is that glut is limited in how it handles messages coming in from multiple windows simultaneously. I need to create my own message loop, rather than using glut's, to get the multithreaded capabilities,
    The XWindows framework will allow me to do what I want, but it does not seem to want to play well with OpenGL and the shader extensions.

    I cannot seem to figure out how to get the right versions of the libraries to compile/link together. The older version of OpenGL with GLX does not seem to have the implementations of the shader extensions - and the newer OpenGL version (2.1) throws compile errors on the glX methods.
    I have tried different combinatons of g++ compile and link commands to try to pull in the right libraries, but with no luck.
    BTW, I am not using XCode or an IDE. The build is all command line.
  5. bigfoot811 thread starter macrumors newbie

    Aug 24, 2009
    Thanks, I will try the GLEW and see if it gives me a clue.
    I ran otools a few times and I can see that wrong versions are being used and I have found where the correct libs exist, but I cannot get the compiler/linker to behave and pull (GLX) from one location and (2.1) from another location.

Share This Page