PDA

View Full Version : First example in OpenGL



8Observer8
08-07-2014, 12:20 AM
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:



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?

8Observer8
08-07-2014, 02:57 AM
I will use Qt instead GLFW :)

Ruggero Visitnin
08-07-2014, 06:12 AM
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:



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

8Observer8
08-07-2014, 06:36 AM
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+

Agent D
08-07-2014, 09:53 AM
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?

8Observer8
08-07-2014, 10:06 AM
glfwOpenWindow returns false :)

Ruggero Visitnin
08-07-2014, 12:31 PM
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?

8Observer8
08-07-2014, 09:12 PM
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

Ruggero Visitnin
08-21-2014, 02:31 PM
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)

8Observer8
08-21-2014, 09:50 PM
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:
1404
- Click the "Apply" button