0

I am trying to get the GLFW3 working on my workstation. I did install GLFW3 on my Ubuntu 12.04 from http://www.glfw.org/download.html

Here is the program I am trying. Got it from GLFW official site http://www.glfw.org/documentation.html

#include <GLFW/glfw3.h>

#include <iostream>

int main(void)
{
    GLFWwindow* window;

    /* Initialize the library */
    if (!glfwInit())
    {
        std::cout<< "xxx\n";
        return -1;
        }

    /* Create a windowed mode window and its OpenGL context */
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window)
    {
            std::cout<< "yyy\n";
        glfwTerminate();
        return -1;
    }

    /* Make the window's context current */
    glfwMakeContextCurrent(window);

    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
    {
        /* Render here */

        /* Swap front and back buffers */
        glfwSwapBuffers(window);

        /* Poll for and process events */
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

Followed this stackoverflow question How to build & install GLFW 3 and use it in a Linux project

compiled it as -

g++ -I/usr/local/include  glfw.cpp -L/usr/local/lib -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi -lrt

It could successfully compile. However when I launch the executable, I it prints

yyy

Which means the window was not created. What could have been wrong, how can I fix it?

Community
  • 1
  • 1
mkuse
  • 2,250
  • 4
  • 32
  • 61
  • 3
    You can [set an error callback](http://www.glfw.org/docs/latest/quick.html#quick_capture_error) to get the actual error. – Leiaz Sep 03 '14 at 10:40
  • 2
    Check the link in his comment. – Colonel Thirty Two Sep 03 '14 at 12:12
  • "GLX: Failed to find a suitable GLXFBConfig" is the error I get. Any clue on how to get by this issue? – mkuse Sep 04 '14 at 04:01
  • I would also like to mention that I have a NVIDIA Cuda enabled card and I use it for parallel computing stuff. Is this coming in the way? – mkuse Sep 04 '14 at 04:08
  • 1
    I actually got it working finally. Had to re-install the NVIDIA graphics drivers. Now openGL works with either of freeglut and glfw. – mkuse Sep 04 '14 at 08:08

0 Answers0