Graphics Reference
In-Depth Information
// Tell OpenGL to go back to rendering to the hardware
// framebuffer:
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
// if you want, have OpenGL create the multiple mipmap layers
// for you
glGenerateMipmap( GL_TEXTURE_2D );
The third code group is straightforward graphics programming with tex-
tures , using the vertex coordinate and texture coordinate functions in compat-
ibility mode for clarity's sake. The texture that was just computed is used in
rendering the scene (here, the simple textured quad).
// now render the rest of the scene as normal, using the Texture
// as you normally would:
. . .
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, Texture );
glBegin( GL_QUADS );
glTexCoord2f( 0., 0. );
glVertex2f( -1., -1. );
glTexCoord2f( 1., 0. );
glVertex2f( 1., -1. );
glTexCoord2f( 1., 1. );
glVertex2f( 1., 1. );
glTexCoord2f( 0., 1. );
glVertex2f( -1., 1. );
glEnd( );
glDisable( GL_TEXTURE_2D );
. . .
Render to Texture for Multipass Rendering in glman
One of the main reasons to do render-to-texture is for multipass rendering
algorithms. To make this easier to experiment with, glman has setup a mecha-
nism make it easy to ask for. The following .glib file shows you how this is
done:
##OpenGL GLIB
Perspective 90
Search WWH ::




Custom Search