Textures from the Frame Buffer

Normally, a texture is defined using data in main memory - an image that was read from a file, or created algorithmically.

It is also possible to take image data from the frame buffer and load it into a texture.

        glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, x, y, width, height, 0);

copies data from a region of the frame buffer into the currently active texture.

With this, we can create a "virtual camera".

Example: copytex.cpp





With an appropriately defined camera, we can make a mirror that reflects the scene.

Example: mirror.cpp



next