VVISF & VVGL
VVGL- GLBuffer create functions

GLBuffer creation functions. 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...
 

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::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...
 

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...
 

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 (CVOpenGLESTextureRef &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.

◆ 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.

◆ 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.

◆ CreateBufferForCVGLTex()

GLBufferRef VVGL::CreateBufferForCVGLTex ( CVOpenGLESTextureRef &  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).

◆ 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).

◆ 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.

◆ 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).

◆ 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).

◆ 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).

◆ 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).