Version: 1.0

Posted: 2004-03-26

Build Requirements: Xcode

Runtime Requirements: Mac OS X v10.3

View Source Code:

Download Sample (“GLCarbonSharedPbuffer.zip”, 221.9K)
Download Sample (“GLCarbonSharedPbuffer.dmg”, 271.8K)



Description

This is a simple sample showing the use of pixel buffers (pbuffers) on Mac OS X v10.3 Panther and later. It renders content into the off screen pbuffer and then uses this as the texture for drawing other objects in the application. In this example a single pbuffer is shared between multiple on screen contexts to provide a texture for all to use. The pbuffer has its own context and the on screen contexts are each associated with a window for their drawing. Texturing is accomplished through AGLs standard context object sharing mechanism. This sample also builds on the GLCarbonAGLWindow sample thus has much of the same support code. See that sample for more information on the surrounding supporting code.

One note when using multiple contexts will want to be followed. One should always flush (glFlush) or swap (aglSwapBuffers) between drawing to different contexts. This means if the scene is finished and you are using a double buffered context aglSwapBuffers should be called, otherwise ensure the commands sent are flushed prior to setting the current context to a different context and drawing.

Document Revision History

Date Notes
2004-03-26Demostrates sharing a single OpenGL pixel buffer with multiple other contexts.

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.