VVISF & VVGL
|
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 | |
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 | |
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... | |
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!
void VVGL::CGBitmapContextUnpremultiply | ( | CGContextRef | ctx | ) |
Unpremultiplies the contents of the bitmap in the passed CGContextRef.
ctx | The contents of this CGContextRef will be unpremultiplied. |
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)
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
size | The size of the buffer to create (in pixels). |
inPoolRef | The 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. |
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.
inCPUBufferSizeInPixels | The 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. |
inCPUBackingPtr | A 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. |
inImageSizeInPixels | The 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. |
inReleaseCallbackContext | An 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). |
inReleaseCallback | This function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function. |
inPoolRef | The 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. |
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)
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
size | The size of the buffer to create (in pixels). |
inPoolRef | The 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. |
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.
inCPUBufferSizeInPixels | The 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. |
inCPUBackingPtr | A 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. |
inImageSizeInPixels | The 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. |
inReleaseCallbackContext | An 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). |
inReleaseCallback | This function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function. |
inPoolRef | The 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. |
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.
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inRep | The bitmap image rep you want to upload to the GL texture. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inTexRef | The 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. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inCVPB | The CVPixelBufferRef whose contents will be uploaded to the texture. |
inTexRange | Whether or not the GL texture should be created using the Apple OpenGL texture range (DMA VRAM). |
inIOSurface | Whether or not the GL texture that is created should have an IOSurface backing (IOSurface backed textures are slower but can be shared between processes). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inImg | The image you want to upload to the GL texture. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inPaths | A vector of paths to image files, each of which is one face of the cube. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inImgs | A vector of CGImageRefs, each of which will be used to populate one of the faces of the cube texture. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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).
inBytes | The memory at this pointer will be used to populate the VBO. |
inByteSize | The size of the memory available at 'inBytes'. |
inUsage | How the VBO is intended to be used. One of several GL vars, like GL_STATIC_DRAW, GL_STREAM_DRAW, etc. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
GLBufferRef VVGL::CreateFBO | ( | const bool & | createInCurrentContext = false , |
const GLBufferPoolRef & | inPoolRef = GetGlobalBufferPool() |
||
) |
Creates and returns a framebuffer object (FBO).
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inTexName | The name of the OpenGL texture that will be used to populate the GLBuffer. |
inTexTarget | The texture target of the OpenGL texture (GLBuffer::Target) |
inTexIntFmt | The internal format of the OpenGL texture. Not as important to get right, used primarily for creating the texture. |
inTexPxlFmt | The pixel format of the OpenGL texture. Not as important to get right, used primarily for creating the texture. |
inTexPxlType | The pixel type of the OpenGL texture. Not as important to get right, used primarily for creating the texture. |
inTexSize | The Size of the OpenGL texture, in pixels. |
inTexFlipped | Whether or not the image in the OpenGL texture is flipped. |
inImgRectInTex | The region of the texture (bottom-left origin, in pixels) that contains the image. |
inReleaseCallbackContext | An 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. |
inReleaseCallback | A 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. |
inPoolRef | The 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). |
GLBufferRef VVGL::CreateRB | ( | const Size & | size, |
const bool & | createInCurrentContext = false , |
||
const GLBufferPoolRef & | inPoolRef = GetGlobalBufferPool() |
||
) |
Creates and returns an OpenGL renderbuffer.
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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)
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
size | The size of the buffer to create (in pixels). |
inPoolRef | The 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. |
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.
inCPUBufferSizeInPixels | The 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. |
inCPUBackingPtr | A 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. |
inImageSizeInPixels | The 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. |
inReleaseCallbackContext | An 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). |
inReleaseCallback | This function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function. |
inPoolRef | The 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. |
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)
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
size | The size of the buffer to create (in pixels). |
inPoolRef | The 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. |
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.
inCPUBufferSizeInPixels | The 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. |
inCPUBackingPtr | A 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. |
inImageSizeInPixels | The 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. |
inReleaseCallbackContext | An 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). |
inReleaseCallback | This function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function. |
inPoolRef | The 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. |
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).
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inSize | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inTarget | GL_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()). |
inUsage | GL_STREAM_DRAW, GL_STREAM_READ, etc. |
inSize | The dimensions of the image that this PBO will need to contain. |
inData | A 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. |
inCreateInCurrentContext | If 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. |
inPoolRef | The 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). |
decoding "GL_STREAM_DRAW, GL_STREAM_READ, etc:
GLBufferRef VVGL::CreateRGBARectTex | ( | const Size & | size, |
const bool & | createInCurrentContext = false , |
||
const GLBufferPoolRef & | inPoolRef = GetGlobalBufferPool() |
||
) |
Creates and returns an OpenGL RECT-target texture.
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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).
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inID | An IOSurfaceID (basically an integer) that was passed to the process. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inSize | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
n | The CGImageRef whose contents will be uploaded to the texture. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inPath | The path of the image file to create a GLBuffer from. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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()).
n | The CMSampleBufferRef whose contents will be uploaded to the texture. This must have a CVPixelBufferRef or the function won't work! |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
GLBufferRef VVGL::CreateVAO | ( | const bool & | createInCurrentContext = false , |
const GLBufferPoolRef & | inPoolRef = GetGlobalBufferPool() |
||
) |
Creates and returns a vertex attribte object (VAO).
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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).
inBytes | The memory at this pointer will be used to populate the VBO. |
inByteSize | The size of the memory available at 'inBytes'. |
inUsage | How the VBO is intended to be used. One of several GL vars, like GL_STATIC_DRAW, GL_STREAM_DRAW, etc. |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.
inCPUBufferSizeInPixels | The 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. |
inCPUBackingPtr | A 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. |
inImageSizeInPixels | The 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. |
inReleaseCallbackContext | An 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). |
inReleaseCallback | This function or block will be executed when the GLBuffer is destroyed- the release callback context from inReleaseCallbackContext is passed to this function. |
inPoolRef | The 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. |
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).
size | The size of the buffer to create (in pixels). |
createInCurrentContext | If 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. |
inPoolRef | The 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). |
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.