Texture Mapping / Environmental Mapping.

I am still new to programming with the OpenGL API, but I am learning.

I am working with dynamic texture mapping, and I think I have accomplished something a little more difficult than I was intending.

I have an image (.rgb) that I am trying to place as a ‘backgound’ in my window, and then have an environmental mapped 3D object (like a sphere or torus) reflect that background.

What I have done is texture mapped the image onto the object instead of the window.

Does anyone know how to fix this problem, so that I can get the image into the background of the window?

[I am working in X, not Windows]

Any help would be greatly appreciated.

Switch off depth test and writes. Draw a textured quad that fills the whole viewport. The texture should be the background texture.
Switch on depth tests and writes again. Then switch to environment coord auto generation and draw the object.