I’m getting into trouble when I try to use textureCube in my fragment program. I’ve checked that my cubemap creation should be fine, no errors there. I get a valid uniform location for my samplerCube, but as soon as I try to use textureCube in my fragment program I get no output (no object rendered). So I figure it must be me or the driver … I have Radeon X700 with Catalyst 6.1 (OpenGL version 220.127.116.1129), maybe this is something I should update? Or am I missing some ‘obvious’ thing like do I have to use glActiveTexture(GL_TEXTURE0) for cubemaps…?
Textures have to be bound to the corresponding active texture unit! Enabling and disabling isn’t needed for use in shader programs.
The sampler in fragment shader must point to the sampler stage index to which the texture is bound. I seriously doubt that this could be a problem with the driver (cube samplers are really common). One way to verify would be to use the env map extension just to test things out or write the cube map to file. To verify that your sampler lookup vector in fragment shader is correct, try writing the vector in gl_FragColor and analyzing the color output for inconsistencies/errors.
Hi, thanks to all for replying. I finally found out the reason and it was simply because I had not made these two innocent looking calls
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
Now I’m not sure what the spec says about this but I would call this a ‘driver issue’ as one would suspect that the driver inits some meaningfull defaults instead of just stop rendering…
The default value of GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR.
As far as I remember specs say that if you use mipmaps, and you have not properly specified images for all mipmap levels, then the result is as texturing would be disabled.
If you had current alpha value set to 0 (or some small value) and alpha blending or alpha test enabled, then it could cause entire object to dissapear.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.