Sumeet002 / oglsuperbible5

Automatically exported from code.google.com/p/oglsuperbible5
0 stars 0 forks source link

Chapter 2...InitializeStockShaders() returns false #35

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Unknown

What is the expected output? What do you see instead?
InitializeStockShaders() return true; but it returns false
shaded triangle; blank triangle

What version of the product are you using? On what operating system?
Irrelevent? Windows 7 Ultimate x64, the latest SB5.zip package from the book 
site.

Please provide any additional information below.
I know nothing about dealing with GLSL, hence I am reading this book.
Using the latest version of GLEW.
I have my own framework which I use to get a window to draw in etc., but I set 
up everything to actually draw the triangle exactly like in the example. I can 
confirm everything needed to set up OpenGL is done. The triangle draws, but the 
shader apparently fails to compile and the result is a white, unshaded 
triangle. Doing something like "myobjectname.InitializeStockShaders();" yields 
a return value of false. I really don't understand the process of compiling 
shader programs at this point, so it's extremely frustrating to delve into this 
code that I have no way to understand, but it looks like in the 
gltLoadShaderPairSrcWithAttributes() function the first call to glGetShaderiv() 
returns GL_FALSE when processing GLT_SHADER_IDENTITY.

It boggles my mind. I have no idea what to google for. Totally stuck. Any help 
is appreciated.

Original issue reported on code.google.com by robojesu...@gmail.com on 31 Aug 2011 at 2:27

GoogleCodeExporter commented 8 years ago
I did some more sifting and found a way to get an error output from the shader 
compiler.

I hacked it into the shader manager code...anyway i get:
ERROR: error (#272) Implicit version number 110 not supported by GL3 forward 
compatible context

Of course googling this yields no information. I can't even find where to 
lookup ANY compiler errors. Hopefully that sheds some light on the problem for 
some one.

Original comment by robojesu...@gmail.com on 31 Aug 2011 at 3:01

GoogleCodeExporter commented 8 years ago
during my window setup, when I get the rendering context using 
wglCreateContextAttribsARB(), if I feed in version 2.1, the shader compiles 
with no problem and I see a red triangle. Indeed, selecting version 3.0 or 3.1 
also works. 3.2 or 3.3 result in the same error:

Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward 
compatible context
ERROR: error(#273) 2 compilation errors. No code generated

Is this an issue with my hardware/driver? Or a problem with the shader code? My 
driver is up to date. My graphics card (Radeon HD 4870) shipped with OpenGL 3.2 
support, so I would at least expect the shader to compile with a version 3.2 
context specified...

Original comment by robojesu...@gmail.com on 31 Aug 2011 at 6:13

GoogleCodeExporter commented 8 years ago
[quote]
Indeed, selecting version 3.0 or 3.1 also works. 3.2 or 3.3 result in the same 
error:
[/quote]
This is because in OpenGL3.2 and above the version qualifier is necessary. If u 
donot specify it, the an implicit version 110 is assumed and so the compiler 
generates the errors. To resolve these simply add #version 330 or #version 320 
depending on th e version of OpenGL u r targetting.

Original comment by mmmova...@gmail.com on 14 Dec 2011 at 6:41