Version: 1.1

Posted: 2004-03-26

Build Requirements: Xcode

Runtime Requirements: Mac OS X glut 3.1+, Mac OS X 10.2.3 or later.

View Source Code:

Download Sample (“GLUTSurfaceTexture.zip”, 765.7K)
Download Sample (“GLUTSurfaceTexture.dmg”, 890.2K)



Description

A fairly simple example of using glutSurfaceTexture to texture from one surface to

another.

Surface textre API notes:

glutSurfaceTexture (GLenum target, GLenum internalformat, int surfacewin)

target: Specifies an allowable 2D OpenGL texture target such as GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_EXT.

internalformat: Specifies the internal texture layout, which must be a supported format listed on table 3.15, 3.16, 3.17 or 3.18 of the OpenGL 1.3 Specification.

surfacewin: Specifies the GLUT window from which to get the texture.

glutSurfaceTexture allows direct texturing from a window by using the window contents as the source data for the texture, behaving much the same way as glTexImage2D. The texture target, internal format must be supported the renderer of the target context. Additionally, the source window geometry must be compatible with the texture target. Thus, if the texture target is GL_TEXTURE_2D, the window must conform to power of two dimensions.

This routine is designed for performance so the graphics driver will attempt to provide an optimum data path, keeping the data in VRAM if possible. Also, there is no window tracking, thus both target and source windows must be on the same virtual screen (renderer) or failure (likely lack of texturing) will result.

Document Revision History

Date Notes
2004-03-26Fixed bug in which sample was incorrectly using the default texture (not allowed with surface texture). Corrected other rendering problems dealing with lighting and glut current windows. Updated for Xcode. Updated sample code disclaimers.
2003-02-20Example of using the new glutSurfaceTexture.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.