PDA

View Full Version : Problem with cubemap fetch



S&W
05-31-2004, 05:10 AM
I'm now rewriting my dynamic cubemapping demo into GLSL shaders from fixed pipelines,
but I have a problem with cubemap fetch and the cubemap location.

fragment shader:


uniform samplerCube CubeMap;

varying vec3 vTexCoord;

void main(void)
{
gl_FragColor = textureCube(CubeMap, vTexCoord);
}main program:


#define CUBE_MAP_ID 0

GLuint g_CubeMap;

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, g_CubeMap);
g_CubeMapLoc = glGetUniformLocationARB(g_ProgObj, "CubeMap");
glUniform1iARB(g_CubeMapLoc, CUBE_MAP_ID);Does anywone know what the problem is?

Thanks.

V-man
05-31-2004, 01:24 PM
Looks fine to me but make sure g_CubeMapLoc is not -1 and vTexCoord contains good values.

jra101
05-31-2004, 02:01 PM
Did you call glUseProgramObjectARB(g_ProgObj) before calling glUniform1iARB?

Are you getting any OpenGL errors?

S&W
05-31-2004, 08:37 PM
Yep, both g_CubeMapLoc and vTexCoord contain correct values.
And of course I'm calling glUseProgramObjectARB() before calling calling glUniform1iARB().

This is very mysterious for me...
I gotta keep working on this.