First example in OpenGL

Hi,

Sorry for my English in advance :slight_smile:

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
");
return;
}


Why is "glfwOpenWindow" failed?

I will use Qt instead GLFW :slight_smile:

[QUOTE=8Observer8;1260852]Hi,

Sorry for my English in advance :slight_smile:

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
");
return;
}


Why is "glfwOpenWindow" failed?[/QUOTE]

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

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+

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?

glfwOpenWindow returns false :slight_smile:

[QUOTE=8Observer8;1260858]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+[/QUOTE]

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?

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/260png_3478510_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/261png_8998539_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/262png_4730614_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

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)

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:
    [ATTACH=CONFIG]719[/ATTACH]
  • Click the “Apply” button