vvopensource
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
Instance Methods | Class Methods | Properties
GLScene Class Reference

Wrapper around a GL context with the intent of standardizing the more common render-to-texture operations while also making it easier to write customizable rendering code that doesn't necessarily require a different subclass for every purpose. Most of the rendering classes I write either use an instance of GLScene to do their rendering or descend directly from it (GLScene's nature- a discrete GL context with built-in render-to-texture- makes it a good choice of superclass when adding support for other hardware-accelerated APIs). More...

#import <GLScene.h>

Inherits NSObject.

Inherited by CIGLScene, GLShaderScene, QCGLScene, VVBufferCopier, and VVBufferPool.

Instance Methods

(id) - initWithSharedContext:
 Init an instance of GLScene using the passed shared context.
 
(id) - initWithSharedContext:sized:
 Init an instance of GLScene using the passed shared context. The GLScene will automatically be configured to render at the passed size.
 
(id) - initWithSharedContext:pixelFormat:
 Init an instance of GLScene using the passed shared context and pixel format.
 
(id) - initWithSharedContext:pixelFormat:sized:
 Init an instance of GLScene using the passed shared context and pixel format. The GLScene will automatically be configured to render at the passed size.
 
(VVBuffer *) - allocAndRenderABuffer
 Allocate a VVBuffer of the appropriate size, renders into this buffer, and then return it. Probably the "main" rendering method.
 
(void) - renderInMSAAFBO:colorRB:depthRB:fbo:colorTex:depthTex:target:
 This is the low-level rendering method- if you want to fool around with MSAA or build a leaner interface, you'll probably want to use this. More...
 
(void) - setClearNSColor:
 Set the clear color from the passed NSColor.
 
(void) - setClearColor:
 Set the clear color from the passed array of GLfloats.
 
(void) - setClearColors::::
 Set the clear color from the passed color values.
 

Class Methods

(NSMutableArray *) + gpuVendorArray
 Returns an array of the GPUs currently accessible by the renderer accessible being used with this process.
 
(BOOL) + integratedGPUFlag
 Returns a YES if you're using an integrated GPU.
 
(BOOL) + nvidiaGPUFlag
 Returns a YES if you're using an NVIDIA GPU.
 
(GLuint) + glDisplayMaskForAllScreens
 Returns a GL display mask that encompassess all your screens.
 
(NSOpenGLPixelFormat *) + defaultPixelFormat
 Returns a default NSOpenGLPixelFormat instance. If you don't explicitly set a pixel format when creating your instances of GLScene (and its subclasses), this is the pixel format that will be used.
 

Properties

NSSize size
 Set the size at which this scene should render.
 
id renderTarget
 Every time this scene renders, the "renderSelector" is called on "renderTarget".
 
SEL renderSelector
 Every time this scene renders, the "renderSelector" is called on "renderTarget". You put your drawing code in the "renderSelector".
 

Detailed Description

Wrapper around a GL context with the intent of standardizing the more common render-to-texture operations while also making it easier to write customizable rendering code that doesn't necessarily require a different subclass for every purpose. Most of the rendering classes I write either use an instance of GLScene to do their rendering or descend directly from it (GLScene's nature- a discrete GL context with built-in render-to-texture- makes it a good choice of superclass when adding support for other hardware-accelerated APIs).

much of the gl stuff i do is two-dimensional (using gl or gl-backed frameworks to process images/video), frequently in a multi-threaded environment (multiple GL contexts are rendering simultaneously on different threads and sharing resources- all in a threadsafe manner).

this class is basically a wrapper for a gl context. it gives me a simple, reusable interface for rendering into a passed fbo/texture, and lets me treat it as a two-dimensional resource- this dovetails nicely with VVBuffer/VVBufferPool, which gives me a retain/release interface for managing these resources.

while this class is part of the VVBufferPool framework, the low-level methods for rendering take simple GL texture/renderbuffer names. there's a higher-level method that returns a VVBuffer instance- but this class itself can be used with GL resources created outside this framework, as well. likewise, subclasses of GLScene can generally be used with GL resources created outside this framework...

Method Documentation

- (void) renderInMSAAFBO: (GLuint)  mf
colorRB: (GLuint)  mc
depthRB: (GLuint)  md
fbo: (GLuint)  f
colorTex: (GLuint)  t
depthTex: (GLuint)  d
target: (GLuint)  texTarget 

This is the low-level rendering method- if you want to fool around with MSAA or build a leaner interface, you'll probably want to use this.

Parameters
mfthe name of an FBO that will be used for the MSAA rendering, or 0
mcthe name of a renderbuffer that can be used as a color attachment for the mf FBO (this will be the image that you render- but not the "final" image), or 0
mdthe name of a renderbuffer that can be used as a depth attachment for the mf FBO, or 0
fthe name of an FBO that will be used to blit the MSAA renderbuffer to a texture, or 0
tthe name of a texture that can be used as a color attachment for the f FBO (this is probably going to be the texture that you want to work with), or 0
dthe name of a texture that can be used as a depth attachment for the f FBO, or 0
texTargetthe target of the textures used as attachments in t and d (2D or RECT)

The documentation for this class was generated from the following files: