VVISF & VVGL
VVGL::GLCPUToTexCopier Class Reference

Uploads CPU-based GLBuffers (Type_CPU) to textures. More...

#include <GLCPUToTexCopier.hpp>

Public Member Functions

GLContextRef context ()
 Gets the context.
 
void clearStream ()
 Clears all the queues, called when freed.
 
void setQueueSize (const int &inNewQueueSize)
 Sets the size of the queue used for streaming. Effectively, this is the number of calls it takes for the CPU data to "finish uploading" and get returned as a texture.
 
int queueSize ()
 Returns the size of the queue used for streaming.
 
GLBufferRef uploadCPUToTex (const GLBufferRef &inCPUBuffer, const bool &createInCurrentContext=false)
 Immediately uploads the passed CPU-based buffer to a GL texture- doesn't use the queues. Less efficient. Good for quick single-shot texture uploads.
 
GLBufferRef uploadCPUToTex (const GLBufferRef &inCPUBuffer, const GLBufferRef &inTexBuffer, const bool &createInCurrentContext=false)
 Immediately uploads the passed CPU-based buffer to the passed GL texture- doesn't use the queues. Less efficient. Good for quick single-shot texture uploads. Does not check the format or dimensions of the passed texture- make sure it's correct before calling!
 
GLBufferRef streamCPUToTex (const GLBufferRef &inCPUBuffer, const bool &createInCurrentContext=false)
 Begins uploading the passed CPU-based buffer to a GL texture, but stashes it in a queue and will return the texture when this function is called again at a later time (ping-pong/double-/triple-/n-buffering). Good for streaming texture upload. More...
 
GLBufferRef streamCPUToTex (const GLBufferRef &inCPUBuffer, const GLBufferRef &inTexBuffer, const bool &createInCurrentContext=false)
 Begins uploading the passed CPU-based buffer to the passed GL texture, but stashes it in a queue and will return the texture when this function is called again at a later time (ping-pong/double-/triple-/n-buffering). Good for streaming texture upload. Does not check the format or dimensions of the passed texture- make sure it's correct before calling! More...
 
void setPrivatePool (const GLBufferPoolRef &n)
 Sets the receiver's private buffer pool (which should default to null). If non-null, this buffer pool will be used to generate any GL resources required by this scene. Handy if you have a variety of GL contexts that aren't shared and you have to switch between them rapidly on a per-frame basis.
 
GLBufferPoolRef privatePool ()
 Gets the receiver's private buffer pool- null by default, only non-null if something called setPrivatePool().
 

Related Functions

(Note that these are not member functions.)

using GLCPUToTexCopierRef = shared_ptr< GLCPUToTexCopier >
 A GLCPUToTexCopierRef is a shared pointer around a GLCPUToTexCopier.
 
GLCPUToTexCopierRef CreateGLCPUToTexCopierRef ()
 Creates and returns a GLCPUToTexCopier. The scene makes a new GL context which shares the context of the global buffer pool.
 
GLCPUToTexCopierRef CreateGLCPUToTexCopierRefUsing (const GLContextRef &inCtx)
 Creates and returns a GLCPUToTexCopier. The downloader uses the passed GL context to perform its GL operations.
 

Detailed Description

Uploads CPU-based GLBuffers (Type_CPU) to textures.

Offers both immediate upload and n-buffered texture uploads for double-/triple-/n-buffering/ping-ponging. Uses PBOs for async DMA.

Member Function Documentation

◆ streamCPUToTex() [1/2]

GLBufferRef VVGL::GLCPUToTexCopier::streamCPUToTex ( const GLBufferRef &  inCPUBuffer,
const bool &  createInCurrentContext = false 
)

Begins uploading the passed CPU-based buffer to a GL texture, but stashes it in a queue and will return the texture when this function is called again at a later time (ping-pong/double-/triple-/n-buffering). Good for streaming texture upload.

Parameters
inCPUBufferThis must be a CPU-based GLBuffer. This may not be null.
createInCurrentContextDefaults to false- if true, any GL resources will be created by the current GL context in the calling thread. If false, the local var _queueCtx will be used. More efficient than uploadCPUToTex()- CPU use will probably be lower and execution will return to the calling thread more rapidly, though the queue means that there's more latency (it won't start returning buffers until you submit one or two- depending on the size of the queue).

◆ streamCPUToTex() [2/2]

GLBufferRef VVGL::GLCPUToTexCopier::streamCPUToTex ( const GLBufferRef &  inCPUBuffer,
const GLBufferRef &  inTexBuffer,
const bool &  createInCurrentContext = false 
)

Begins uploading the passed CPU-based buffer to the passed GL texture, but stashes it in a queue and will return the texture when this function is called again at a later time (ping-pong/double-/triple-/n-buffering). Good for streaming texture upload. Does not check the format or dimensions of the passed texture- make sure it's correct before calling!

Parameters
inCPUBufferThis must be a CPU-based GLBuffer. This may not be null.
createInCurrentContextDefaults to false- if true, any GL resources will be created by the current GL context in the calling thread. If false, the local var _queueCtx will be used. More efficient than uploadCPUToTex()- CPU use will probably be lower and execution will return to the calling thread more rapidly, though the queue means that there's more latency (it won't start returning buffers until you submit one or two- depending on the size of the queue).

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