Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: First example in OpenGL

  1. #1

    First example in OpenGL

    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: www.openglsuperbibleDOTcom/

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

    Code CPP:
                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?

  2. #2
    I will use Qt instead GLFW

  3. #3
    Intern Contributor
    Join Date
    Jul 2014
    Location
    Italy, Lissone
    Posts
    80
    Quote Originally Posted by 8Observer8 View Post
    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: www.openglsuperbibleDOTcom/

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

    Code CPP:
                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?
    did you download the example model zip too?
    second question are you shure that there is glfw include and header in your example?

    i have that book too and i don't have any kind of problems

  4. #4
    What is "model zip"?

    Yes, I sure. I found the answer. I have OpenGL drivers 3.0 But for glfwOpenWindow need the version 3.3+

  5. #5
    Junior Member Regular Contributor Agent D's Avatar
    Join Date
    Sep 2011
    Location
    Innsbruck, Austria
    Posts
    249
    Quote Originally Posted by 8Observer8 View Post
    But for glfwOpenWindow need the version 3.3+
    Nope.

    You can specify the desired context and version for glfwOpenWindow by setting glfw window hints. There are default values if none are specified which AFAIK means trying highes available.

    By the way, what dou you mean by fails? Did you determine that this particular line causes the program to exit, or does it fail to compile?

  6. #6
    glfwOpenWindow returns false

  7. #7
    Intern Contributor
    Join Date
    Jul 2014
    Location
    Italy, Lissone
    Posts
    80
    Quote Originally Posted by 8Observer8 View Post
    What is "model zip"?

    Yes, I sure. I found the answer. I have OpenGL drivers 3.0 But for glfwOpenWindow need the version 3.3+
    you have this error because opengl SuperBible 6th edition talks about modern opengl and more specifically about opengl 4.3 so probably the context is initialized as 4.3 i suppose, what graphic card are you using?

  8. #8
    I have:
    - Notebook: Asus X53S
    - OS: Win7
    - IDE: Qt Creator and Visual C++ 2010 Express Edition

    Asus X53S has two graphics processor:

    First graphics processor (by default):
    Vendor: Intel
    Renderer: Intel(R) HD Graphics Family
    Version: 3.0.0 - Build 8.15.10.2291
    GLSL: 1.30 - Intel Build 8.15.10.2291
    Second graphics processor:
    Vendor: NVIDIA Corporation
    Renderer: GeForce GT 540M/PCI/SSE2
    Version: 4.1.0
    GLSL: 4.10 NVIDIA via Cg compiler
    All examples one can open how single solution:
    http://i6.pixs.ru/storage/4/9/1/260p...0_13320491.png

    I open this solution in Visual C++ 2010 Expess Edition and see that first example (by A/Z) "alienrain" uses shader 410 (I didn't change anything)
    http://i6.pixs.ru/storage/5/0/2/261p...9_13320502.png

    I right click on "alienrain" and select "Build"

    I move to the "bin" folder and find "exe"-file. I run it by second graphics processor:
    http://i.pixs.ru/storage/5/1/5/262pn...4_13320515.png

    I see the window which closes in half second. How you can see I have GLSL 4.10 and example which uses GLSL 4.10 too

  9. #9
    Intern Contributor
    Join Date
    Jul 2014
    Location
    Italy, Lissone
    Posts
    80
    I' m sorry but i can't figure out what your problem is, it could be that the application uses the default graphics card and not your nvidia gpu, you have to change your default graphics card (probably this is not the solution but one try does not costs you anything)

  10. #10
    I found the solution. This is my step-by-step instruction:
    - Open the folder with the exe-file
    - Right click on the exe-file
    - Select: "Run with graphics processor" -> "Change default graphics processor"
    - In the opened window select your exe-file and select the preferred graphics processor, like in the picture:
    Click image for larger version. 

Name:	287.jpg 
Views:	63 
Size:	16.7 KB 
ID:	1404
    - Click the "Apply" button

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •