Skip to main content
GameDev.net gamedev.net
🔒 Locked

First example in OpenGL

Started by 8Observer8 Aug 7, 2014 at 7:11 AM 4 replies 2.3k views
Original Post
8Observer8
8Observer8

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?

BitMaster
BitMaster
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.
8Observer8
8Observer8

I will use Qt instead GLFW :)

8Observer8
8Observer8

How to describe on the thread on this forum?

aregee
aregee

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.

TemaKonkin_N
TemaKonkin_N

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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.