VVISF & VVGL
|
Copies the contents of one texture-type GLBuffer to another texture-type GLBuffer, capable of basic resizing. More...
#include <GLTexToTexCopier.hpp>
Inherits VVGL::GLScene.
Public Member Functions | |
GLTexToTexCopier () | |
Creates a new OpenGL context that shares the global buffer pool's context, uses that to create a new GLTexToTexCopier instance. | |
GLTexToTexCopier (const GLContextRef &inCtx) | |
Uses the passed GL context to create a new GLTexToTexCopier. No new OpenGL context is created- the buffer copier/scene will use the passed context to do its rendering. | |
void | setCopyToIOSurface (const bool &n) |
Sets the _copyToIOSurface flag (Mac SDK only). If true, buffers created by the copier will be backed by IOSurfaces (and can thus be shared with other processes) | |
bool | copyToIOSurface () |
Gets the _copyToIOSurface flag (Mac SDK only). | |
void | setCopyAndResize (const bool &n) |
Sets the _copyAndResize flag. If true, the buffer copier will resize the buffers it copies to '_copySize'. | |
bool | copyAndResize () |
Gets the _copyAndResize flag. | |
void | setCopySize (const Size &n) |
Sets the copySize value. If '_copyAndResize' is true, the buffers the receiver copies will be resized to this size. | |
Size | copySize () |
Gets the copySize value. | |
void | setCopySizingMode (const SizingMode &n) |
The copy sizing mode governs how the buffers are resized if '_copySize' is true and the aspect ratio of source buffer doesn't match the target size's aspect ratio. | |
SizingMode | copySizingMode () |
Gets the copy sizing mode. | |
GLBufferRef | copyToNewBuffer (const GLBufferRef &n) |
Returns a new GLBuffer which was made by rendering the passed buffer into a new texture of matching dimensions. | |
bool | copyFromTo (const GLBufferRef &a, const GLBufferRef &b) |
Copies the first passed buffer into the second, returns YES if successful- if sizes don't match or either buffer is nil, bails and returns NO! ignores "_copyToIOSurface" and "copyPixFormat"! | |
void | sizeVariantCopy (const GLBufferRef &a, const GLBufferRef &b) |
Copies the first buffer into the second buffer. will stretch/squash 'a' to fit into 'b'. | |
void | ignoreSizeCopy (const GLBufferRef &a, const GLBufferRef &b) |
Copies the first buffer into the second buffer, completely ignoring sizes- it just draws 'a' in the bottom-left corner of 'b'. the resulting image may depict 'a' as being "too small" or "cropped". | |
void | copyBlackFrameTo (const GLBufferRef &n) |
Fills the passed buffer with transparent black (0., 0., 0., 0.) | |
void | copyOpaqueBlackFrameTo (const GLBufferRef &n) |
Fills the passed buffer with opaque black (0., 0., 0., 1.) | |
void | copyRedFrameTo (const GLBufferRef &n) |
Fills the passed buffer with opaque red (1., 0., 0., 1.) | |
Public Member Functions inherited from VVGL::GLScene | |
GLScene () | |
Creates a new OpenGL context that shares the global buffer pool's context. | |
GLScene (const GLContextRef &inCtx) | |
Creates a new GLScene instance, but not a new OpenGL context- instead it uses the passed GLContext. | |
GLContextRef | context () const |
Returns the context used by this scene. | |
GLVersion | glVersion () const |
Returns the version of OpenGL currently being used by this scene's GL context. | |
void | setPrivatePool (const GLBufferPoolRef &n) |
Sets the receiver's private buffer pool (default is 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 () const |
Gets the receiver's private buffer pool- null by default, only non-null if something called setPrivatePool(). | |
void | setPrivateCopier (const GLTexToTexCopierRef &n) |
Sets the receiver's private buffer copier (which should default to null). If non-null, this copier will be used to copy any resources that need to be copied- like setPrivatePool(), 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. | |
GLTexToTexCopierRef | privateCopier () const |
Gets the receiver's private buffer copier- null by default, only non-null if something called setPrivateCopier(). | |
virtual GLBufferRef | createAndRenderABuffer (const Size &inSize=Size(640., 480.), const GLBufferPoolRef &inPool=nullptr) |
Creates an 8 bit per channel GL texture, uses it as a color attachment to the GL context and then renders into it. Calls setOrthoSize() with the size of the image in the passed buffer. | |
virtual void | renderToBuffer (const GLBufferRef &inBuffer) |
Uses the passed buffer as a color attachment to the GL context and then renders into it. Calls setOrthoSize() with the size of the image in the passed buffer. | |
virtual void | render (const RenderTarget &inRenderTarget=RenderTarget()) |
Renders the GL scene, uses whatever attachments are present in the passed RenderTarget. Doesn't call setOrthoSize() before rendering! | |
virtual void | renderBlackFrame (const RenderTarget &inRenderTarget=RenderTarget()) |
Makes the scene render transparent black into whatever attachments are present in the passed RenderTarget. | |
virtual void | renderOpaqueBlackFrame (const RenderTarget &inRenderTarget=RenderTarget()) |
Makes the scene render opaque black into whatever attachments are present in the passed RenderTarget. | |
virtual void | renderRedFrame (const RenderTarget &inRenderTarget=RenderTarget()) |
Makes the scene render opaque red into whatever attachments are present in the passed RenderTarget. | |
void | setRenderPreLinkCallback (const RenderCallback &n) |
The render pre-link callback is executed if there's a shader after the shader/shaders have been successfully compiled, but before they've been linked. Procedurally, this is the first callback to execute. You probably don't want to perform any draw calls in this callback- this is a good time to configure your geometry shader. | |
void | setRenderPrepCallback (const RenderPrepCallback &n) |
The render prep callback is executed after any shaders have been compiled and linked, after the attachments have been made, and after the framebuffer has been cleared (assuming the scene is configured to perform a clear). Procedurally, this is the second callback to execute, and the last to execute before draw calls are expected. You probably don't want to perform any draw calls in this callback- this is a good time to do any ancillary setup outside of this scene that needs to occur before drawing begins. | |
void | setRenderCallback (const RenderCallback &n) |
The render callback is expected to contain the drawing code that you want the scene to perform. Procedurally, this is the third callback to execute. | |
void | setRenderCleanupCallback (const RenderCallback &n) |
The render cleanup callback is executed immediately after the render callback. Procedurally, this is the fourth and final callback to execute as a result of a render call. You probably don't want to perform any draw calls in this callback- the context has already been flushed and there isn't a framebuffer any more. This is a good time to do any ancillary teardown outside of this scene that needs to occur before you finish and return execution to whatever started rendering. | |
void | setAlwaysNeedsReshape (const bool &n) |
Defaults to false. If set to true, the viewport and orthogonal projection setup is applied every single frame (GL2 uses glOrtho, GL3+ uses a 4x4 matrix uniform in the shader to pass a projection transform to the program). You can leave this false unless you plan on modifying the viewport or equivalent of projection matrices in your callbacks. | |
virtual void | setOrthoSize (const Size &n) |
Sets the orthogonal render size. If the size is 0x0 then orthogonal rendering is skipped- any other positive values will cause the scene to configure itself for orthographic projection at the passed size during rendering. | |
Size | orthoSize () const |
Gets the orthogonal render size. If the size is 0x0 then orthogonal rendering is disabled. | |
void | setOrthoFlipped (const bool &n) |
The _orthoFlipped member variable defaults to false- if it's set to true, the orthographic projection or equivalent will be flipped vertically. | |
bool | orthoFlipped () const |
Gets the value of the _orthoFlipped member variable. If this is true, the orthographic projection or equivalent will be flipped vertically. | |
void | setClearColor (const GLColor &n) |
Sets the clear color to the passed color. | |
void | setClearColor (const float &r, const float &g, const float &b, const float &a) |
Sets the color color using the passed float values. | |
void | setClearColor (float *n) |
Sets the clear color using a pointer to enough memory to contain four float values. | |
void | setPerformClear (const bool &n) |
Sets the '_performClear' member variable. If it's true (the default) the context will clear to its clear color prior to drawing. The clear is performed before the render prep callback. | |
virtual void | setVertexShaderString (const string &n) |
Sets the vertex shader string. | |
virtual string | vertexShaderString () |
Gets the vertex shader string. | |
virtual void | setGeometryShaderString (const string &n) |
Sets the geometry shader string. | |
virtual string | geometryShaderString () |
Gets the geometry shader string. | |
virtual void | setFragmentShaderString (const string &n) |
Sets the fragment shader string. | |
virtual string | fragmentShaderString () |
Gets the fragment shader string. | |
uint32_t | program () const |
Gets the program ID. | |
Related Functions | |
(Note that these are not member functions.) | |
using | GLTexToTexCopierRef = shared_ptr< GLTexToTexCopier > |
A GLTexToTexCopierRef is a shared pointer around a GLTexToTexCopier. | |
GLTexToTexCopierRef | CreateGLTexToTexCopierRef () |
Creates and returns a GLTexToTexCopier. The scene makes a new GL context which shares the context of the global buffer pool. | |
GLTexToTexCopierRef | CreateGLTexToTexCopierRefUsing (const GLContextRef &inCtx) |
Creates and returns a GLTexToTexCopier. The downloader uses the passed GL context to perform its GL operations. | |
Related Functions inherited from VVGL::GLScene | |
using | GLSceneRef = shared_ptr< GLScene > |
A GLSceneRef is a shared pointer around a GLScene. | |
GLSceneRef | CreateGLSceneRef () |
Creates and returns a GLScene. The scene makes a new GL context which shares the context of the global buffer pool. | |
GLSceneRef | CreateGLSceneRefUsing (const GLContextRef &inCtx) |
Creates and returns a GLScene. The scene uses the passed GL context to do its drawing. | |
Additional Inherited Members | |
Public Types inherited from VVGL::GLScene | |
using | RenderCallback = std::function< void(const GLScene &inScene)> |
This defines the interface for a function/lambda that is used for encapsulating user-provided drawing code. Both the render callback and the render cleanup callback use this type. More... | |
using | RenderPrepCallback = std::function< void(const GLScene &inScene, const bool &inSceneReshaped, const bool &inPgmChanged)> |
This defines the interface for the render prep callback, which is executed prior to the render callback. More... | |
Copies the contents of one texture-type GLBuffer to another texture-type GLBuffer, capable of basic resizing.
This object copies the image data in a GLBuffer by drawing it while another GLBuffer is bound as the render target. This performs GL rendering- GLTexToTexCopier is a subclass of GLScene, so it has a GL context it can use. If you require GLTexToTexCopier to use an existing GLContext to draw, use the constructor that accepts a GLContextRef (much like the GLScene constructor with the same signature)