glTexImage2D - where does it copy from

Hello

I wanted to make sure I understood - this isn’t written explicitly anywhere: the source of the pixels that are copied into the texture depends on the format given with glCopyTexImage2D?
for example
if i specify GL_DEPTH_COMPONENT, then the texture image format will be depth component and also, pixels will be arriving from the depth buffer and not the color buffer, as would have been if i would have specified GL_RGBA or something.

ty!

It’s all right there for you…

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texsubimage2d.html

Your assumptions about the source of the texture data are not correct.
Data is uploaded to VRAM from system memory, and a copy is kept in system memory (in case the VRAM copy gets flushed).

Reading from Depth Buffers etc. is a completely different kettle of fish.

I think you might have misunderstood his question. The API he’s asking about is glCopyTexImage2D. Man page is here. I gather we should ignore the incorrect API name he used in the subject.

As the man page says, this copies pixels from the current GL_READ_BUFFER (which you of course set with glReadBuffer()).

However, I think his question is how does this API know to read from the color buffer, depth buffer, stencil buffer, accumulation buffer, etcetc. within this active read buffer as the source of the data that is copied to the texture.

Man page doesn’t really address, but it alludes to the answer in the errors:

Dark Photon - good catch on that line in the errors - it doesn’t implicilty state what i wanted to know, but it is reassuring -

it seems the peeps who wrote the api find it obvious that you would like to copy the depth buffer to a depth texture - i imagine that if i would like to do something crazy like render to a color buffer, and then use it as a depth texture, i’d need some other way.