VVISF & VVGL
VVGL- GLBuffer create functions

GLBuffer creation functions. More...

Functions

GLBufferRef VVGL::CreateBufferForNSImage (NSImage *inImg, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture with the contents of the passed NSImage. The GL texture will be 8 bits per pixel/RGBA, alpha is supported. More...
 
GLBufferRef VVGL::CreateBufferForBitmapRep (NSBitmapImageRep *inRep, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture with the contents of the passed NSBitmapImageRep. The GL texture will be 8 bits per pixel/RGBA, alpha is supported. More...
 

Non-Image buffer creation functions

These functions create GLBuffers that aren't actually images at all.

GLBufferRef VVGL::CreateFBO (const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a framebuffer object (FBO). More...
 
GLBufferRef VVGL::CreateVBO (const void *inBytes, const size_t &inByteSize, const int32_t &inUsage, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a vertex buffer object (VBO). More...
 
GLBufferRef VVGL::CreateEBO (const void *inBytes, const size_t &inByteSize, const int32_t &inUsage, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an element buffer object (EBO). More...
 
GLBufferRef VVGL::CreateVAO (const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a vertex attribte object (VAO). More...
 

Renderbuffer creation functions

These functions create GLBuffers that are renderbuffers (not textures).

GLBufferRef VVGL::CreateRB (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL renderbuffer. More...
 

CPU-based buffer creation functions

These functions create GLBuffers that are entirely CPU-based- no GL resources. Some of these functions allocate memory- others just create a GLBuffer representation of an existing block of memory that was created by another API.

GLBufferRef VVGL::CreateRGBACPUBuffer (const Size &size, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that uses a 32 bit per pixel non-planar RGBA CPU buffer as its backing. This GLBuffer doesn't have any GL resources. The CPU buffer is allocated by this function. More...
 
GLBufferRef VVGL::CreateRGBAFloatCPUBuffer (const Size &size, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that uses a 128 bit per pixel non-planar RGBA CPU buffer as its backing. This GLBuffer doesn't have any GL resources. The CPU buffer is allocated by this function. More...
 
GLBufferRef VVGL::CreateBGRACPUBuffer (const Size &size, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that uses a 32 bit per pixel non-planar BGRA CPU buffer as its backing. This GLBuffer doesn't have any GL resources. The CPU buffer is allocated by this function. More...
 
GLBufferRef VVGL::CreateBGRAFloatCPUBuffer (const Size &size, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that uses a 128 bit per pixel non-planar BGRA CPU buffer as its backing. This GLBuffer doesn't have any GL resources. The CPU buffer is allocated by this function. More...
 
GLBufferRef VVGL::CreateRGBACPUBufferUsing (const Size &inCPUBufferSizeInPixels, const void *inCPUBackingPtr, const Size &inImageSizeInPixels, const void *inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback &inReleaseCallback, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that describes a non-planar RGBA image (32 bits per pixel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory. More...
 
GLBufferRef VVGL::CreateRGBAFloatCPUBufferUsing (const Size &inCPUBufferSizeInPixels, const void *inCPUBackingPtr, const Size &inImageSizeInPixels, const void *inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback &inReleaseCallback, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that describes a non-planar RGBA image (128 bits per pixel, or 32 bits per channel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory. More...
 
GLBufferRef VVGL::CreateBGRACPUBufferUsing (const Size &inCPUBufferSizeInPixels, const void *inCPUBackingPtr, const Size &inImageSizeInPixels, const void *inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback &inReleaseCallback, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that describes a non-planar BGRA image (32 bits per pixel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory. More...
 
GLBufferRef VVGL::CreateBGRAFloatCPUBufferUsing (const Size &inCPUBufferSizeInPixels, const void *inCPUBackingPtr, const Size &inImageSizeInPixels, const void *inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback &inReleaseCallback, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that describes a non-planar BGRA image (128 bits per pixel, or 32 bits per channel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory. More...
 
GLBufferRef VVGL::CreateYCbCrCPUBufferUsing (const Size &inCPUBufferSizeInPixels, const void *inCPUBackingPtr, const Size &inImageSizeInPixels, const void *inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback &inReleaseCallback, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that describes a non-planar YCbCr image (16 bits per pixel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory. More...
 

Texture Buffers

These functions create GLBuffers that are OpenGL textures

GLBufferRef VVGL::CreateRGBATex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal RGBA format and is 8 bits per component (32 bit color). More...
 
GLBufferRef VVGL::CreateRGBAFloatTex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal RGBA format and is 32 bits per component (128 bit color). More...
 
GLBufferRef VVGL::CreateYCbCrTex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal RGB (no alhpa!) format and is 32 bits per component (128 bit color). Internally, the data store for this texture is expected to be packed (non-planar) YCbCr data (uyvy or 2vuy). More...
 
GLBufferRef VVGL::CreateDepthBuffer (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture configured to be a 16 bit per pixel depth buffer. More...
 
GLBufferRef VVGL::CreateFromExistingGLTexture (const int32_t &inTexName, const GLBuffer::Target &inTexTarget, const GLBuffer::InternalFormat &inTexIntFmt, const GLBuffer::PixelFormat &inTexPxlFmt, const GLBuffer::PixelType &inTexPxlType, const Size &inTexSize, const bool &inTexFlipped, const Rect &inImgRectInTex, const void *inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback &inReleaseCallback, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that wraps an existing OpenGL texture that was created by another SDK. This does not take ownership of the texture- instead, you supply a backing release callback that will be executed when the GLBuffer is freed. More...
 
GLBufferRef VVGL::CreateBGRATex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal BGRA format (BGRA is optimized on most platforms) and is 8 bits per component. More...
 
GLBufferRef VVGL::CreateBGRAFloatTex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal BGRA format and is 32 bits per component. More...
 

CPU-backed Texture Image Buffers

These functions create GLBuffers that are OpenGL textures backed by a CPU buffer. Changes made to the CPU buffer can be quickly pushed to the GL texture.

GLBufferRef VVGL::CreateRGBACPUBackedTex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal RGBA format, is 8 bits per component, and has a CPU backing (the CPU backing is highly accelerated and is basically DMA with VRAM as a result of various extensions and optimizations) More...
 
GLBufferRef VVGL::CreateRGBAFloatCPUBackedTex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal RGBA format, is 32 bits per component, and has a CPU backing (the CPU backing is highly accelerated and is basically DMA with VRAM as a result of various extensions and optimizations) More...
 
GLBufferRef VVGL::CreateBGRACPUBackedTex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal BGRA format, is 8 bits per component, and has a CPU backing (the CPU backing is highly accelerated and is basically DMA with VRAM as a result of various extensions and optimizations) More...
 
GLBufferRef VVGL::CreateBGRAFloatCPUBackedTex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that has an internal BGRA format, is 32 bits per component, and has a CPU backing (the CPU backing is highly accelerated and is basically DMA with VRAM as a result of various extensions and optimizations) More...
 

Image file to buffer functions

These functions create GLBuffers from image files on disk

GLBufferRef VVGL::CreateTexFromImage (const string &inPath, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture from the image at the passed path. More...
 
GLBufferRef VVGL::CreateCubeTexFromImagePaths (const vector< string > &inPaths, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL cube texture from the images at the passed paths. More...
 

PBO creation functions

These functions create GLBuffers that represent PBOs, which are used primarily to stream image data to/from GPUs.

GLBufferRef VVGL::CreateRGBAPBO (const GLBuffer::Target &inTarget, const int32_t &inUsage, const Size &inSize, const void *inData=nullptr, const bool &inCreateInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates a GLBufferRef that represents a PBO (pixel buffer object). These functions are used by GLTexToCPUCopier and GLBufferTexUploader to move memory between RAM and VRAM. More...
 
GLBufferRef VVGL::CreateBGRAPBO (const int32_t &inTarget, const int32_t &inUsage, const Size &inSize, const void *inData=nullptr, const bool &inCreateInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates a GLBufferRef that represents a PBO. See the documentation of CreateRGBAPBO() for more information- PBOs do not contain inherently typed data, these functions only differ in the contents of the GLBuffer::Descriptor they populate.
 
GLBufferRef VVGL::CreateRGBAFloatPBO (const int32_t &inTarget, const int32_t &inUsage, const Size &inSize, const void *inData=nullptr, const bool &inCreateInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates a GLBufferRef that represents a PBO. See the documentation of CreateRGBAPBO() for more information- PBOs do not contain inherently typed data, these functions only differ in the contents of the GLBuffer::Descriptor they populate.
 
GLBufferRef VVGL::CreateBGRAFloatPBO (const int32_t &inTarget, const int32_t &inUsage, const Size &inSize, const void *inData=nullptr, const bool &inCreateInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates a GLBufferRef that represents a PBO. See the documentation of CreateRGBAPBO() for more information- PBOs do not contain inherently typed data, these functions only differ in the contents of the GLBuffer::Descriptor they populate.
 
GLBufferRef VVGL::CreateYCbCrPBO (const int32_t &inTarget, const int32_t &inUsage, const Size &inSize, const void *inData=nullptr, const bool &inCreateInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates a GLBufferRef that represents a PBO. See the documentation of CreateRGBAPBO() for more information- PBOs do not contain inherently typed data, these functions only differ in the contents of the GLBuffer::Descriptor they populate.
 

Mac-only buffer creation functions

These functions create GLBuffers that aren't actually images at all.

void VVGL::PushTexRangeBufferRAMtoVRAM (const GLBufferRef &inBufferRef, const GLContextRef &inContextRef)
 Some GLBuffers are GL textures with a CPU backing- this function pushes the contents of the CPU backing to the GL texture. More...
 
GLBufferRef VVGL::CreateRGBATexIOSurface (const Size &inSize, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates an 8 bit per channel RGBA OpenGL texture backed by an IOSurface that also gets created- the contents of this texture can be shared with other processes by sharing the IOSurface. More...
 
GLBufferRef VVGL::CreateRGBAFloatTexIOSurface (const Size &inSize, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates a 32 bit per channel RGBA OpenGL texture backed by an IOSurface that also gets created- the contents of this texture can be shared with other processes by sharing the IOSurface. More...
 
GLBufferRef VVGL::CreateRGBATexFromIOSurfaceID (const IOSurfaceID &inID, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer representing a texture that is backed by an IOSurface that was created by another process and passed to this process using the passed IOSurfaceID. More...
 
GLBufferRef VVGL::CreateBufferForCVPixelBuffer (CVPixelBufferRef &inCVPB, const bool &inTexRange, const bool &inIOSurface, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that is populated with the contents of the passed CVPixelBufferRef. More...
 
GLBufferRef VVGL::CreateTexRangeFromCMSampleBuffer (CMSampleBufferRef &n, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture that is populated with the contents of the passed CMSampleBufferRef (uses CreateBufferForCVPixelBuffer()). More...
 
GLBufferRef VVGL::CreateRGBARectTex (const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL RECT-target texture. More...
 

Mac- and iOS-only buffer creation functions

These functions create GLBuffers that aren't actually images at all.

GLBufferRef VVGL::CreateTexFromCGImageRef (const CGImageRef &n, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns an OpenGL texture populated with the contents of the passed CGImageRef. More...
 
GLBufferRef VVGL::CreateCubeTexFromImages (const vector< CGImageRef > &inImgs, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a cube-type OpenGL texture populated with the passed vector of CGImageRefs. More...
 
void VVGL::CGBitmapContextUnpremultiply (CGContextRef ctx)
 Unpremultiplies the contents of the bitmap in the passed CGContextRef. More...
 
GLBufferRef VVGL::CreateBufferForCVGLTex (CVOpenGLTextureRef &inTexRef, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
 Creates and returns a GLBuffer that represents the texture in the passed CVOpenGLTextureRef. VVGL won't actually create any GL resources here- it's basically just using GLBuffer as a wrapper around the GL resource owned by the CVOpenGLTextureRef. More...
 

Detailed Description

GLBuffer creation functions.

These functions create GLBuffer instances. Note that these functions all require a GLBufferPool- you need to create a buffer pool before you can create any buffers!

Function Documentation

◆ CGBitmapContextUnpremultiply()

void VVGL::CGBitmapContextUnpremultiply ( CGContextRef  ctx)

Unpremultiplies the contents of the bitmap in the passed CGContextRef.

Parameters
ctxThe contents of this CGContextRef will be unpremultiplied.

◆ CreateBGRACPUBackedTex()

GLBufferRef VVGL::CreateBGRACPUBackedTex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal BGRA format, is 8 bits per component, and has a CPU backing (the CPU backing is highly accelerated and is basically DMA with VRAM as a result of various extensions and optimizations)

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateBGRACPUBuffer()

GLBufferRef VVGL::CreateBGRACPUBuffer ( const Size size,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that uses a 32 bit per pixel non-planar BGRA CPU buffer as its backing. This GLBuffer doesn't have any GL resources. The CPU buffer is allocated by this function.

Parameters
sizeThe size of the buffer to create (in pixels).
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateBGRACPUBufferUsing()

GLBufferRef VVGL::CreateBGRACPUBufferUsing ( const Size inCPUBufferSizeInPixels,
const void *  inCPUBackingPtr,
const Size inImageSizeInPixels,
const void *  inReleaseCallbackContext,
const GLBuffer::BackingReleaseCallback inReleaseCallback,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that describes a non-planar BGRA image (32 bits per pixel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory.

Parameters
inCPUBufferSizeInPixelsThe size of the buffer at inCPUBackingPtr, expressed in pixels. If the image is padded, this size needs to include the padding. If the padding is a non-integral value, you can't use this function and will instead have to create a CPU buffer (using CreateRGBACPUBuffer() or another function that allocates memory) and copy the image data to it.
inCPUBackingPtrA pointer to the memory containing the image data- this is the data that will eventually get uploaded to OpenGL (the bitmap data). Must not be null.
inImageSizeInPixelsThe size of the image at inCPUBackingPtr, expressed in pixels. This is the size of the image- not the size of the buffer- and as such, it should not include any padding.
inReleaseCallbackContextAn arbitrary pointer you supply. A weak ref to this pointer is maintained by the GLBuffer, and it is passed to the buffer's release callback (which is executed when the buffer is freed).
inReleaseCallbackThis function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function.
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateBGRAFloatCPUBackedTex()

GLBufferRef VVGL::CreateBGRAFloatCPUBackedTex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal BGRA format, is 32 bits per component, and has a CPU backing (the CPU backing is highly accelerated and is basically DMA with VRAM as a result of various extensions and optimizations)

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateBGRAFloatCPUBuffer()

GLBufferRef VVGL::CreateBGRAFloatCPUBuffer ( const Size size,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that uses a 128 bit per pixel non-planar BGRA CPU buffer as its backing. This GLBuffer doesn't have any GL resources. The CPU buffer is allocated by this function.

Parameters
sizeThe size of the buffer to create (in pixels).
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateBGRAFloatCPUBufferUsing()

GLBufferRef VVGL::CreateBGRAFloatCPUBufferUsing ( const Size inCPUBufferSizeInPixels,
const void *  inCPUBackingPtr,
const Size inImageSizeInPixels,
const void *  inReleaseCallbackContext,
const GLBuffer::BackingReleaseCallback inReleaseCallback,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that describes a non-planar BGRA image (128 bits per pixel, or 32 bits per channel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory.

Parameters
inCPUBufferSizeInPixelsThe size of the buffer at inCPUBackingPtr, expressed in pixels. If the image is padded, this size needs to include the padding. If the padding is a non-integral value, you can't use this function and will instead have to create a CPU buffer (using CreateRGBACPUBuffer() or another function that allocates memory) and copy the image data to it.
inCPUBackingPtrA pointer to the memory containing the image data- this is the data that will eventually get uploaded to OpenGL (the bitmap data). Must not be null.
inImageSizeInPixelsThe size of the image at inCPUBackingPtr, expressed in pixels. This is the size of the image- not the size of the buffer- and as such, it should not include any padding.
inReleaseCallbackContextAn arbitrary pointer you supply. A weak ref to this pointer is maintained by the GLBuffer, and it is passed to the buffer's release callback (which is executed when the buffer is freed).
inReleaseCallbackThis function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function.
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateBGRAFloatTex()

GLBufferRef VVGL::CreateBGRAFloatTex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal BGRA format and is 32 bits per component.

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateBGRATex()

GLBufferRef VVGL::CreateBGRATex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal BGRA format (BGRA is optimized on most platforms) and is 8 bits per component.

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateBufferForBitmapRep()

GLBufferRef VVGL::CreateBufferForBitmapRep ( NSBitmapImageRep *  inRep,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture with the contents of the passed NSBitmapImageRep. The GL texture will be 8 bits per pixel/RGBA, alpha is supported.

Parameters
inRepThe bitmap image rep you want to upload to the GL texture.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateBufferForCVGLTex()

GLBufferRef VVGL::CreateBufferForCVGLTex ( CVOpenGLTextureRef &  inTexRef,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that represents the texture in the passed CVOpenGLTextureRef. VVGL won't actually create any GL resources here- it's basically just using GLBuffer as a wrapper around the GL resource owned by the CVOpenGLTextureRef.

Parameters
inTexRefThe CVOpenGLTextureRef that will be used to populate the GLBuffer. The GLBuffer's member variables are populated using the properties from the texture ref- no GL resources are created or destroyed.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateBufferForCVPixelBuffer()

GLBufferRef VVGL::CreateBufferForCVPixelBuffer ( CVPixelBufferRef &  inCVPB,
const bool &  inTexRange,
const bool &  inIOSurface,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that is populated with the contents of the passed CVPixelBufferRef.

Parameters
inCVPBThe CVPixelBufferRef whose contents will be uploaded to the texture.
inTexRangeWhether or not the GL texture should be created using the Apple OpenGL texture range (DMA VRAM).
inIOSurfaceWhether or not the GL texture that is created should have an IOSurface backing (IOSurface backed textures are slower but can be shared between processes).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateBufferForNSImage()

GLBufferRef VVGL::CreateBufferForNSImage ( NSImage *  inImg,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture with the contents of the passed NSImage. The GL texture will be 8 bits per pixel/RGBA, alpha is supported.

Parameters
inImgThe image you want to upload to the GL texture.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateCubeTexFromImagePaths()

GLBufferRef VVGL::CreateCubeTexFromImagePaths ( const vector< string > &  inPaths,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL cube texture from the images at the passed paths.

Parameters
inPathsA vector of paths to image files, each of which is one face of the cube.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateCubeTexFromImages()

GLBufferRef VVGL::CreateCubeTexFromImages ( const vector< CGImageRef > &  inImgs,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a cube-type OpenGL texture populated with the passed vector of CGImageRefs.

Parameters
inImgsA vector of CGImageRefs, each of which will be used to populate one of the faces of the cube texture.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateDepthBuffer()

GLBufferRef VVGL::CreateDepthBuffer ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture configured to be a 16 bit per pixel depth buffer.

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateEBO()

GLBufferRef VVGL::CreateEBO ( const void *  inBytes,
const size_t &  inByteSize,
const int32_t &  inUsage,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an element buffer object (EBO).

Parameters
inBytesThe memory at this pointer will be used to populate the VBO.
inByteSizeThe size of the memory available at 'inBytes'.
inUsageHow the VBO is intended to be used. One of several GL vars, like GL_STATIC_DRAW, GL_STREAM_DRAW, etc.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateFBO()

GLBufferRef VVGL::CreateFBO ( const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a framebuffer object (FBO).

Parameters
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateFromExistingGLTexture()

GLBufferRef VVGL::CreateFromExistingGLTexture ( const int32_t &  inTexName,
const GLBuffer::Target &  inTexTarget,
const GLBuffer::InternalFormat inTexIntFmt,
const GLBuffer::PixelFormat &  inTexPxlFmt,
const GLBuffer::PixelType &  inTexPxlType,
const Size inTexSize,
const bool &  inTexFlipped,
const Rect inImgRectInTex,
const void *  inReleaseCallbackContext,
const GLBuffer::BackingReleaseCallback inReleaseCallback,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that wraps an existing OpenGL texture that was created by another SDK. This does not take ownership of the texture- instead, you supply a backing release callback that will be executed when the GLBuffer is freed.

Parameters
inTexNameThe name of the OpenGL texture that will be used to populate the GLBuffer.
inTexTargetThe texture target of the OpenGL texture (GLBuffer::Target)
inTexIntFmtThe internal format of the OpenGL texture. Not as important to get right, used primarily for creating the texture.
inTexPxlFmtThe pixel format of the OpenGL texture. Not as important to get right, used primarily for creating the texture.
inTexPxlTypeThe pixel type of the OpenGL texture. Not as important to get right, used primarily for creating the texture.
inTexSizeThe Size of the OpenGL texture, in pixels.
inTexFlippedWhether or not the image in the OpenGL texture is flipped.
inImgRectInTexThe region of the texture (bottom-left origin, in pixels) that contains the image.
inReleaseCallbackContextAn arbitrary pointer stored (weakly) with the GLBuffer- this pointer is passed to the release callback. If you want to store a pointer from another SDK, this is the appropriate place to do so.
inReleaseCallbackA callback function or lambda that will be executed when the GLBuffer is deallocated. If the GLBuffer needs to release any other resources when it's freed, this is the appropriate place to do so.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRB()

GLBufferRef VVGL::CreateRB ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL renderbuffer.

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRGBACPUBackedTex()

GLBufferRef VVGL::CreateRGBACPUBackedTex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal RGBA format, is 8 bits per component, and has a CPU backing (the CPU backing is highly accelerated and is basically DMA with VRAM as a result of various extensions and optimizations)

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRGBACPUBuffer()

GLBufferRef VVGL::CreateRGBACPUBuffer ( const Size size,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that uses a 32 bit per pixel non-planar RGBA CPU buffer as its backing. This GLBuffer doesn't have any GL resources. The CPU buffer is allocated by this function.

Parameters
sizeThe size of the buffer to create (in pixels).
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateRGBACPUBufferUsing()

GLBufferRef VVGL::CreateRGBACPUBufferUsing ( const Size inCPUBufferSizeInPixels,
const void *  inCPUBackingPtr,
const Size inImageSizeInPixels,
const void *  inReleaseCallbackContext,
const GLBuffer::BackingReleaseCallback inReleaseCallback,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that describes a non-planar RGBA image (32 bits per pixel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory.

Parameters
inCPUBufferSizeInPixelsThe size of the buffer at inCPUBackingPtr, expressed in pixels. If the image is padded, this size needs to include the padding. If the padding is a non-integral value, you can't use this function and will instead have to create a CPU buffer (using CreateRGBACPUBuffer() or another function that allocates memory) and copy the image data to it.
inCPUBackingPtrA pointer to the memory containing the image data- this is the data that will eventually get uploaded to OpenGL (the bitmap data). Must not be null.
inImageSizeInPixelsThe size of the image at inCPUBackingPtr, expressed in pixels. This is the size of the image- not the size of the buffer- and as such, it should not include any padding.
inReleaseCallbackContextAn arbitrary pointer you supply. A weak ref to this pointer is maintained by the GLBuffer, and it is passed to the buffer's release callback (which is executed when the buffer is freed).
inReleaseCallbackThis function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function.
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateRGBAFloatCPUBackedTex()

GLBufferRef VVGL::CreateRGBAFloatCPUBackedTex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal RGBA format, is 32 bits per component, and has a CPU backing (the CPU backing is highly accelerated and is basically DMA with VRAM as a result of various extensions and optimizations)

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRGBAFloatCPUBuffer()

GLBufferRef VVGL::CreateRGBAFloatCPUBuffer ( const Size size,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that uses a 128 bit per pixel non-planar RGBA CPU buffer as its backing. This GLBuffer doesn't have any GL resources. The CPU buffer is allocated by this function.

Parameters
sizeThe size of the buffer to create (in pixels).
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateRGBAFloatCPUBufferUsing()

GLBufferRef VVGL::CreateRGBAFloatCPUBufferUsing ( const Size inCPUBufferSizeInPixels,
const void *  inCPUBackingPtr,
const Size inImageSizeInPixels,
const void *  inReleaseCallbackContext,
const GLBuffer::BackingReleaseCallback inReleaseCallback,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that describes a non-planar RGBA image (128 bits per pixel, or 32 bits per channel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory.

Parameters
inCPUBufferSizeInPixelsThe size of the buffer at inCPUBackingPtr, expressed in pixels. If the image is padded, this size needs to include the padding. If the padding is a non-integral value, you can't use this function and will instead have to create a CPU buffer (using CreateRGBACPUBuffer() or another function that allocates memory) and copy the image data to it.
inCPUBackingPtrA pointer to the memory containing the image data- this is the data that will eventually get uploaded to OpenGL (the bitmap data). Must not be null.
inImageSizeInPixelsThe size of the image at inCPUBackingPtr, expressed in pixels. This is the size of the image- not the size of the buffer- and as such, it should not include any padding.
inReleaseCallbackContextAn arbitrary pointer you supply. A weak ref to this pointer is maintained by the GLBuffer, and it is passed to the buffer's release callback (which is executed when the buffer is freed).
inReleaseCallbackThis function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function.
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateRGBAFloatTex()

GLBufferRef VVGL::CreateRGBAFloatTex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal RGBA format and is 32 bits per component (128 bit color).

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRGBAFloatTexIOSurface()

GLBufferRef VVGL::CreateRGBAFloatTexIOSurface ( const Size inSize,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates a 32 bit per channel RGBA OpenGL texture backed by an IOSurface that also gets created- the contents of this texture can be shared with other processes by sharing the IOSurface.

Parameters
inSizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRGBAPBO()

GLBufferRef VVGL::CreateRGBAPBO ( const GLBuffer::Target &  inTarget,
const int32_t &  inUsage,
const Size inSize,
const void *  inData = nullptr,
const bool &  inCreateInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates a GLBufferRef that represents a PBO (pixel buffer object). These functions are used by GLTexToCPUCopier and GLBufferTexUploader to move memory between RAM and VRAM.

Parameters
inTargetGL_PIXEL_UNPACK_BUFFER or GL_PIXEL_PACK_BUFFER. "pack" means this PBO will be used to transfer pixel data TO a PBO (glReadPixels(), glGetTexImage()). "unpack" means this PBO will be used to transfer pixel data FROM a PBO (glDrawPixels(), glTexImage2D(), glTexSubImage2D()).
inUsageGL_STREAM_DRAW, GL_STREAM_READ, etc.
inSizeThe dimensions of the image that this PBO will need to contain.
inDataA pointer to the data in CPU memory, or null. If this data is padded, 'inSize' needs to describe the size of the image including the padding. Must be at least as large as the value returned by backingLengthForSize() for the appropriate GLBuffer::Descriptor.
inCreateInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).
  • "pack" means this PBO will be used to transfer pixel data TO a PBO (glReadPixels(), glGetTexImage())
  • "unpack" means this PBO will be used to transfer pixel data FROM a PBO (glDrawPixels(), glTexImage2D(), glTexSubImage2D())

decoding "GL_STREAM_DRAW, GL_STREAM_READ, etc:

  • STREAM write once, read at most a few times
  • STATIC write once, read many times
  • DYNAMIC write many times, read many times

  • DRAW CPU -> GL
  • READ GL -> CPU
  • COPY GL -> GL

◆ CreateRGBARectTex()

GLBufferRef VVGL::CreateRGBARectTex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL RECT-target texture.

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRGBATex()

GLBufferRef VVGL::CreateRGBATex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal RGBA format and is 8 bits per component (32 bit color).

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRGBATexFromIOSurfaceID()

GLBufferRef VVGL::CreateRGBATexFromIOSurfaceID ( const IOSurfaceID &  inID,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer representing a texture that is backed by an IOSurface that was created by another process and passed to this process using the passed IOSurfaceID.

Parameters
inIDAn IOSurfaceID (basically an integer) that was passed to the process.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateRGBATexIOSurface()

GLBufferRef VVGL::CreateRGBATexIOSurface ( const Size inSize,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates an 8 bit per channel RGBA OpenGL texture backed by an IOSurface that also gets created- the contents of this texture can be shared with other processes by sharing the IOSurface.

Parameters
inSizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateTexFromCGImageRef()

GLBufferRef VVGL::CreateTexFromCGImageRef ( const CGImageRef &  n,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture populated with the contents of the passed CGImageRef.

Parameters
nThe CGImageRef whose contents will be uploaded to the texture.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateTexFromImage()

GLBufferRef VVGL::CreateTexFromImage ( const string &  inPath,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture from the image at the passed path.

Parameters
inPathThe path of the image file to create a GLBuffer from.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateTexRangeFromCMSampleBuffer()

GLBufferRef VVGL::CreateTexRangeFromCMSampleBuffer ( CMSampleBufferRef &  n,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that is populated with the contents of the passed CMSampleBufferRef (uses CreateBufferForCVPixelBuffer()).

Parameters
nThe CMSampleBufferRef whose contents will be uploaded to the texture. This must have a CVPixelBufferRef or the function won't work!
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateVAO()

GLBufferRef VVGL::CreateVAO ( const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a vertex attribte object (VAO).

Parameters
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateVBO()

GLBufferRef VVGL::CreateVBO ( const void *  inBytes,
const size_t &  inByteSize,
const int32_t &  inUsage,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a vertex buffer object (VBO).

Parameters
inBytesThe memory at this pointer will be used to populate the VBO.
inByteSizeThe size of the memory available at 'inBytes'.
inUsageHow the VBO is intended to be used. One of several GL vars, like GL_STATIC_DRAW, GL_STREAM_DRAW, etc.
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ CreateYCbCrCPUBufferUsing()

GLBufferRef VVGL::CreateYCbCrCPUBufferUsing ( const Size inCPUBufferSizeInPixels,
const void *  inCPUBackingPtr,
const Size inImageSizeInPixels,
const void *  inReleaseCallbackContext,
const GLBuffer::BackingReleaseCallback inReleaseCallback,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns a GLBuffer that describes a non-planar YCbCr image (16 bits per pixel) in CPU memory- doesn't create any GL resources, and also doesn't allocate the CPU memory required for the image. This function is a good way to create a GLBuffer using a block of memory from another API- the release callback and release callback context can be used to ensure that the GLBuffer has a strong reference to any memory structures that need to exist for the duration of the GLBuffer's lifetime. This function does not copy any memory.

Parameters
inCPUBufferSizeInPixelsThe size of the buffer at inCPUBackingPtr, expressed in pixels. If the image is padded, this size needs to include the padding. If the padding is a non-integral value, you can't use this function and will instead have to create a CPU buffer (using CreateRGBACPUBuffer() or another function that allocates memory) and copy the image data to it.
inCPUBackingPtrA pointer to the memory containing the image data- this is the data that will eventually get uploaded to OpenGL (the bitmap data). Must not be null.
inImageSizeInPixelsThe size of the image at inCPUBackingPtr, expressed in pixels. This is the size of the image- not the size of the buffer- and as such, it should not include any padding.
inReleaseCallbackContextAn arbitrary pointer you supply. A weak ref to this pointer is maintained by the GLBuffer, and it is passed to the buffer's release callback (which is executed when the buffer is freed).
inReleaseCallbackThis function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function.
inPoolRefThe pool that the GLBuffer should be created with. This is a CPU-based buffer, so there aren't any GL resources that need to be freed by a GL context, but it has a pool regardless.

◆ CreateYCbCrTex()

GLBufferRef VVGL::CreateYCbCrTex ( const Size size,
const bool &  createInCurrentContext = false,
const GLBufferPoolRef &  inPoolRef = GetGlobalBufferPool() 
)

Creates and returns an OpenGL texture that has an internal RGB (no alhpa!) format and is 32 bits per component (128 bit color). Internally, the data store for this texture is expected to be packed (non-planar) YCbCr data (uyvy or 2vuy).

Parameters
sizeThe size of the buffer to create (in pixels).
createInCurrentContextIf true, the GL resource will be created in the current context (assumes that a GL context is active in the current thread). If false, the GL resource will be created by the GL context owned by the buffer pool.
inPoolRefThe pool that the GLBuffer should be created with. When the GLBuffer is freed, its underlying GL resources will be returned to this pool (where they will be either freed or recycled).

◆ PushTexRangeBufferRAMtoVRAM()

void VVGL::PushTexRangeBufferRAMtoVRAM ( const GLBufferRef &  inBufferRef,
const GLContextRef &  inContextRef 
)

Some GLBuffers are GL textures with a CPU backing- this function pushes the contents of the CPU backing to the GL texture.

Parameters
inBufferRefThe GLBuffer whose contents will be uploaded. This has to be a GLBuffer with a CPU backing or the function won't do anything!
inContextRefThis is the context that will be used to upload the image data from RAM to VRAM. This must not be null!