First example in OpenGL

Started by
4 comments, last by TemaKonkin_N 9 years, 8 months ago

Hi,

Sorry for my English in advance :)

I am new in OpenGL. I started from the book SuperBible, 6th

I downloaded the examples from the website: http://www.openglsuperbible.com/

I opened "solution" of the examples in Visual 2010 Express Edition. I ran "alienrain" example but it failed here:

            if (!glfwOpenWindow(info.windowWidth, info.windowHeight, 8, 8, 8, 0, 32, 0, GLFW_WINDOW))
            {
                fprintf(stderr, "Failed to open window\n");
                return;
            }

Why is "glfwOpenWindow" failed?

Advertisement
I have no clue what you mean by "failed". When you have problems you should always copy and paste the exact error message.

If by "failed" you mean "unresolved external" then you will need to link to the GLFW library.

I will use Qt instead GLFW :)

How to describe on the thread on this forum?

Do you mean that you are getting the following error message:

"Failed to open window"?

In that case, it means your code is compiling just fine, but you are probably sending some wrong parameters to GLFW somewhere.

If you add this in the beginning of your code, before you initialise GLFW or do anything related to GLFW:


    glfwSetErrorCallback(error_callback);

And then add this function to your code:


static void error_callback(int error, const char* description)
{
    fputs(description, stderr);
    printf("\n");
}

You should see the proper error message in the console.

If your code doesn't even compile, there can be lots of reasons. Please provide more specific error message.

EDIT:

I am a bit weary about you using glfwOpenWindow() function, as I can see it mentioned in old documentation, but not in new documentation. The newer version is using glfwCreateWindow(). Which version of GLFW are you using? My compiler can't even find that function. I suggest you go to the "Getting Started" guide on the GLFW web page: http://www.glfw.org/docs/latest/quick.html and compile a newer version of GLFW.

Hi,

Sorry for my English in advance smile.png

I am new in OpenGL. I started from the book SuperBible, 6th

I downloaded the examples from the website: http://www.openglsuperbible.com/

I opened "solution" of the examples in Visual 2010 Express Edition. I ran "alienrain" example but it failed here:


            if (!glfwOpenWindow(info.windowWidth, info.windowHeight, 8, 8, 8, 0, 32, 0, GLFW_WINDOW))
            {
                fprintf(stderr, "Failed to open window\n");
                return;
            }

Why is "glfwOpenWindow" failed?

Use the SDl for create window, and you will be happy!

https://wiki.libsdl.org/SDL_CreateWindow

Sorry for the error, use an interpreter.

This topic is closed to new replies.

Advertisement