Reflective Textures

Hi, I trying to implement reflective textures in my programe by using the following code

pngInfo info;
texture		= pngBind("reflection.png",		PNG_NOMIPMAP, PNG_SOLID, &info, GL_CLAMP, GL_LINEAR, GL_LINEAR);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D , texture);

glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);

The problem is I’m not using png files instead I load the file myself into memory and simply provide Ogl with the necessay info (width,height, pointer to memory, etc) but I don’t know why it won’t work, I seem to be getting sphere mapping. One thing my code doesn’t mention at all is GL_CLAMP but I don’t know whrer I should use it if at all.
Thanks

GL_REFLECTION_MAP_NV gives appropriate coordinates for cube map reflection. You should be using GL_TEXTURE_CUBE_MAP_ARB, not GL_TEXTURE_2D.

You also need to have a cube map, not a normal texture. I would recommend checking out the demos and whitepapers on the NVIDIA developer site (www.nvidia.com/developer).

j

That soesn’t seem to be working. I’ve tried commenting out certain bit of code here and there and most of it seems to do nothing. I always get the same Sphere based maping always centered in the middle of the screen and the four corners of the texture coming together in the center. The code I’m trying to copy doesn’t mention GL_TEXTURE_CUBE_MAP_ARB anywhere. Note I also tried to implement NeHe quadratic sphere mapping with the same results. I used to exact code as NeHe tut but I it won’t work.