to write (render) to (Render-to-texture)?
An OpenGL extension called EXT_framebuffer_object allows you to take a texture object (created with glTexImage2D() as above) and “attach” it to a framebuffer (a renderable entity). This provides a lightweight mechanism to “divert” the output of a rendering / computation pass away from the framebuffer for immediate display, but into a texture which can be used again as input for subsequent passes. See Aaron Lefohn’s framebuffer object sourcecode for a framebuffer object class and example application. An older OpenGL extension called “pbuffers” provided a more heavy-weight way to accomplish all of this. [TODO: provide a lot more detail about pbuffers] A program that uses Direct3D can create a texture, specifying that it will be used as a render target, and then render into it by calling SetRenderTarget().