Texturing Problem with GLSL


I’m having problems accessing textures in a GLSL shader.

I figured I would start with something really simple, so I compiled and ran the ogl2brick-2.0 example from the OpenGL Shading Language book (3dshaders.com).

When I run the example, the object should be a red brick wall, but it is totally black. Any ideas what’s going on?


What platform, OS, hardware, graphic driver are you working with?

64 Linux OpenSuse 10.3

GL_VERSION returns: 3.0.0 NVIDIA 180.29

The card’s an 8800.

I upgraded to 180.51, but that didn’t help.

That’s weird, it works perfectly on Ubuntu 9.04 with latest mesa drivers. I have no more ideas, do you get any opengl error, compile or link errors from the shader program?

No OpenGL error, compile or link errors. I did comment out glewInit() and I removed the glew library from the Makefile. I don’t have glew and I don’t think that would make a difference, would it?

So from the beginning you are compiling an running the example code without glew?
Anyway, glew is important to use some opengl extensions. It allows you to get automatically the function call entry points of any supported extension. Install the glew package on your distribution and link to this library. See if there is any change.

But I do not know what happen with opengl 3.0, you should have to use glew for shaders.


I tried as you said without glew since shaders where promoted to core in opengl 2.0 and guess what: I do not have exactly a black screen but a uniformly green cube. But this is not very relevant since I hacked a lot with my distro and is now quite unstable ^^.

Ok, I installed glew. I reverted the program so it links with glew, it has #include <glew.h>, and it calls glewInit().

Now, I get a red brick wall. Why does glew give me a red brick wall but standard OpenGL 3.0 doesn’t?