copy data to textures

Hi,

I’m facing a little problem. I think it must be an easy thing, but I really can’t figure it out.

I have, for my internship, to copy what’s rendered on the screen into textures (here cubemap textures).

When I use gluBuild2DMipmaps the data is copied into the texture (I then use glReadPixel before). When I use glTexImage2D (with same glReadPixel before), no data are copied.
The same, and was my first try: glCopyTexImage2D does not copy data to the texture.

I’ve did this many times before (including glCopyTexImage2D) without issues at all. But here, I can’t figure out to make glCopyTexImage2D to work.

I use GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB+i (with i an integer between 0 and 5) as format for all tested functions, GL_RGB8 as internal format.

Something says me it might be the mipmap level since gluBuild2DMipmaps works but not the others ones but I can’t understand why.

Any hints ?

How do you verify that something was copied? If you render something with the copied texture data and you use a minification filter that uses mipmapping you need to provide all levels. Try rendering with something like GL_LINEAR.

Is the image black? As the poster before me indicated, you must ensure that the mipmap chain is complete (assuming mipmapping is enabled and desired). If this is the case, your best option is to enable automatic mipmap generation with GL_GENERATE_MIPMAP_SGIS. You can then just make one call to glTexImage2D for level 0, and GL takes care of the rest.

http://www.opengl.org/registry/specs/SGIS/generate_mipmap.txt

And for alternatives, see GL wiki: http://www.opengl.org/wiki/Texture

I textured an object to verify the data. Plus I created image files of glReadPixel.

Anyway, thank you a lot. My texture creation model used mipmapping for minification (I used the same as for the previous cubemap one).

Sorry for the bothering…