PDA

View Full Version : textureCube lookup problem



niko
03-05-2006, 05:53 AM
Hello,

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 6.14.10.5529), 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...?

/niko

kon
03-05-2006, 01:05 PM
Textures have to be bound to the corresponding active texture unit! Enabling and disabling isn't needed for use in shader programs.

glActiveTexture(...)
glBindTexture(...)

kon

Zulfiqar Malik
03-05-2006, 09:02 PM
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.

niko
03-06-2006, 01:26 AM
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...

/niko

k_szczech
03-06-2006, 12:47 PM
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.