VVISF & VVGL
GLBufferPool.hpp
1 #ifndef VVGL_GLBufferPool_hpp
2 #define VVGL_GLBufferPool_hpp
3 
4 #include "VVGL_Defines.hpp"
5 
6 #include <mutex>
7 
8 #include "GLBuffer.hpp"
9 
10 #if defined(VVGL_SDK_MAC)
11 #import <CoreGraphics/CoreGraphics.h>
12 #import <TargetConditionals.h>
13 #import <CoreMedia/CoreMedia.h>
14 #import <CoreVideo/CoreVideo.h>
15 #elif defined(VVGL_SDK_IOS)
16 #import <CoreGraphics/CoreGraphics.h>
17 #import <CoreVideo/CoreVideo.h>
18 #elif defined(VVGL_SDK_QT)
19 #include <QVideoFrame>
20 #endif
21 
22 
23 
24 
25 namespace VVGL {
26 
27 
28 using namespace std;
29 
30 
31 
32 
34 
44 class VVGL_EXPORT GLBufferPool {
45 
46  // vars
47  protected:
48  bool _deleted = false;
49  mutex _freeBuffersLock;
50  vector<GLBufferRef> _freeBuffers;
51 
52  recursive_mutex _contextLock;
53  GLContextRef _context = nullptr; // this is the context that the buffer pool will use to create/destroy GL resources
54 
55  Timestamp _baseTime;
56 
57 #if defined(VVGL_SDK_MAC) || defined(VVGL_SDK_IOS)
58  CGColorSpaceRef _colorSpace = nullptr;
59 #endif
60 
61  // methods
62  public:
63  //GLBufferPool(const GLContext * inShareCtx=nullptr);
64  GLBufferPool(const GLContextRef & inCtx=nullptr);
65  virtual ~GLBufferPool();
66  // call this method to prep a pool for deletion- this will cause it to purge its contents, refuse to dispense more buffers, and automatically release any buffers that are returned to it
67  inline void prepareToBeDeleted() { _deleted=true; purge(); }
68 
70  GLBufferRef createBufferRef(const GLBuffer::Descriptor & desc, const Size & size={640,480}, const void * backingPtr=nullptr, const Size & backingSize={640,480}, const bool & createInCurrentContext=false);
71  GLBufferRef fetchMatchingFreeBuffer(const GLBuffer::Descriptor & desc, const Size & size);
72 
74  void housekeeping();
76  void purge();
78  inline Timestamp getTimestamp() const { return Timestamp()-_baseTime; }
80  inline void timestampThisBuffer(const GLBufferRef & n) const { if (n == nullptr) return; n->contentTimestamp=getTimestamp(); }
82  inline GLContextRef & context() { return _context; }
83  inline recursive_mutex & getContextLock() { return _contextLock; }
84 #if defined(VVGL_SDK_MAC) || defined(VVGL_SDK_IOS)
85  inline CGColorSpaceRef colorSpace() const { return _colorSpace; }
86 #endif
87 
88  friend ostream & operator<<(ostream & os, const GLBufferPool & n);
89  void flush();
90 
91  private:
92  // Called by GLBuffer when it's being deallocated if the buffer has determined that it is a candidate for recycling
93  void returnBufferToPool(GLBuffer * inBuffer);
94  // Called by GLBuffer when it's being deallocated if the buffer has determined that its GL resources need to be released immediately
95  void releaseBufferResources(GLBuffer * inBuffer);
96 
97  friend GLBuffer::~GLBuffer();
98 };
99 
100 
101 
102 
108 VVGL_EXPORT GLBufferPoolRef CreateGlobalBufferPool(const GLContextRef & inPoolCtx=nullptr);
113 VVGL_EXPORT const GLBufferPoolRef & GetGlobalBufferPool();
118 VVGL_EXPORT void SetGlobalBufferPool(const GLBufferPoolRef & inPoolRef=nullptr);
119 
120 
121 
122 
127 
135 VVGL_EXPORT GLBufferRef CreateFBO(const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
145 VVGL_EXPORT GLBufferRef CreateVBO(const void * inBytes, const size_t & inByteSize, const int32_t & inUsage, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
155 VVGL_EXPORT GLBufferRef CreateEBO(const void * inBytes, const size_t & inByteSize, const int32_t & inUsage, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
162 VVGL_EXPORT GLBufferRef CreateVAO(const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
163 
165 
166 
167 
168 
173 
182 VVGL_EXPORT GLBufferRef CreateRB(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
183 
185 
186 
187 
188 
193 
201 VVGL_EXPORT GLBufferRef CreateRGBACPUBuffer(const Size & size, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
208 VVGL_EXPORT GLBufferRef CreateRGBAFloatCPUBuffer(const Size & size, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
215 VVGL_EXPORT GLBufferRef CreateBGRACPUBuffer(const Size & size, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
222 VVGL_EXPORT GLBufferRef CreateBGRAFloatCPUBuffer(const Size & size, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
223 
234 VVGL_EXPORT GLBufferRef CreateRGBACPUBufferUsing(const Size & inCPUBufferSizeInPixels, const void * inCPUBackingPtr, const Size & inImageSizeInPixels, const void * inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback & inReleaseCallback, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
245 VVGL_EXPORT GLBufferRef CreateRGBAFloatCPUBufferUsing(const Size & inCPUBufferSizeInPixels, const void * inCPUBackingPtr, const Size & inImageSizeInPixels, const void * inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback & inReleaseCallback, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
256 VVGL_EXPORT GLBufferRef CreateBGRACPUBufferUsing(const Size & inCPUBufferSizeInPixels, const void * inCPUBackingPtr, const Size & inImageSizeInPixels, const void * inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback & inReleaseCallback, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
267 VVGL_EXPORT GLBufferRef CreateBGRAFloatCPUBufferUsing(const Size & inCPUBufferSizeInPixels, const void * inCPUBackingPtr, const Size & inImageSizeInPixels, const void * inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback & inReleaseCallback, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
268 
269 #if !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3)
270 
280 VVGL_EXPORT GLBufferRef CreateYCbCrCPUBufferUsing(const Size & inCPUBufferSizeInPixels, const void * inCPUBackingPtr, const Size & inImageSizeInPixels, const void * inReleaseCallbackContext, const GLBuffer::BackingReleaseCallback & inReleaseCallback, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
281 #endif // !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3)
282 
284 
285 
286 
287 
292 
301 VVGL_EXPORT GLBufferRef CreateRGBATex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
309 VVGL_EXPORT GLBufferRef CreateRGBAFloatTex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
310 
311 #if !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3)
312 
319 VVGL_EXPORT GLBufferRef CreateYCbCrTex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
320 #endif // !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3)
321 
329 VVGL_EXPORT GLBufferRef CreateDepthBuffer(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
345 VVGL_EXPORT GLBufferRef 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());
346 
347 #if !defined(VVGL_SDK_IOS)
348 
355 VVGL_EXPORT GLBufferRef CreateBGRATex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
363 VVGL_EXPORT GLBufferRef CreateBGRAFloatTex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
364 
365 #if defined(VVGL_SDK_MAC)
366 
370 
379 VVGL_EXPORT GLBufferRef CreateRGBACPUBackedTex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
387 VVGL_EXPORT GLBufferRef CreateRGBAFloatCPUBackedTex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
395 VVGL_EXPORT GLBufferRef CreateBGRACPUBackedTex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
403 VVGL_EXPORT GLBufferRef CreateBGRAFloatCPUBackedTex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
404 
406 
407 #endif // VVGL_SDK_MAC
408 #endif // !VVGL_SDK_IOS
409 
411 
412 
413 
414 
419 
428 VVGL_EXPORT GLBufferRef CreateTexFromImage(const string & inPath, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
436 VVGL_EXPORT GLBufferRef CreateCubeTexFromImagePaths(const vector<string> & inPaths, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
437 
439 
440 
441 
442 
443 // none of this stuff should be available if we're running ES
444 #if !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3)
445 
450 
475 VVGL_EXPORT GLBufferRef CreateRGBAPBO(const GLBuffer::Target & inTarget, const int32_t & inUsage, const Size & inSize, const void * inData=nullptr, const bool & inCreateInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
480 VVGL_EXPORT GLBufferRef CreateBGRAPBO(const int32_t & inTarget, const int32_t & inUsage, const Size & inSize, const void * inData=nullptr, const bool & inCreateInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
485 VVGL_EXPORT GLBufferRef CreateRGBAFloatPBO(const int32_t & inTarget, const int32_t & inUsage, const Size & inSize, const void * inData=nullptr, const bool & inCreateInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
490 VVGL_EXPORT GLBufferRef CreateBGRAFloatPBO(const int32_t & inTarget, const int32_t & inUsage, const Size & inSize, const void * inData=nullptr, const bool & inCreateInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
495 VVGL_EXPORT GLBufferRef CreateYCbCrPBO(const int32_t & inTarget, const int32_t & inUsage, const Size & inSize, const void * inData=nullptr, const bool & inCreateInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
496 
498 
499 #endif // !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3)
500 
501 
502 
503 
504 #if defined(VVGL_SDK_QT)
505 
509 
518 VVGL_EXPORT GLBufferRef CreateBufferForQImage(QImage * inImg, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
525 VVGL_EXPORT GLBufferRef CreateCPUBufferForQImage(QImage * inImg, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
532 VVGL_EXPORT GLBufferRef CreateCPUBufferForQVideoFrame(QVideoFrame * inFrame, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
533 
534 
536 #endif
537 
538 
539 
540 
541 #if defined(VVGL_SDK_MAC)
542 
546 
554 VVGL_EXPORT void PushTexRangeBufferRAMtoVRAM(const GLBufferRef & inBufferRef, const GLContextRef & inContextRef);
562 VVGL_EXPORT GLBufferRef CreateRGBATexIOSurface(const Size & inSize, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
570 VVGL_EXPORT GLBufferRef CreateRGBAFloatTexIOSurface(const Size & inSize, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
578 VVGL_EXPORT GLBufferRef CreateRGBATexFromIOSurfaceID(const IOSurfaceID & inID, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
588 VVGL_EXPORT GLBufferRef CreateBufferForCVPixelBuffer(CVPixelBufferRef & inCVPB, const bool & inTexRange, const bool & inIOSurface, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
596 VVGL_EXPORT GLBufferRef CreateTexRangeFromCMSampleBuffer(CMSampleBufferRef & n, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
604 VVGL_EXPORT GLBufferRef CreateRGBARectTex(const Size & size, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
605 
607 #endif
608 
609 
610 
611 
612 #if defined(VVGL_SDK_MAC) || defined(VVGL_SDK_IOS)
613 
617 
626 VVGL_EXPORT GLBufferRef CreateTexFromCGImageRef(const CGImageRef & n, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
634 VVGL_EXPORT GLBufferRef CreateCubeTexFromImages(const vector<CGImageRef> & inImgs, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
640 VVGL_EXPORT void CGBitmapContextUnpremultiply(CGContextRef ctx);
641 
643 #endif
644 
645 
646 
647 
652 #if defined(VVGL_SDK_MAC)
654 
661 VVGL_EXPORT GLBufferRef CreateBufferForCVGLTex(CVOpenGLTextureRef & inTexRef, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
662 #elif defined(VVGL_SDK_IOS)
663 
670 VVGL_EXPORT GLBufferRef CreateBufferForCVGLTex(CVOpenGLESTextureRef & inTexRef, const bool & createInCurrentContext=false, const GLBufferPoolRef & inPoolRef=GetGlobalBufferPool());
671 #endif
672 
674 
675 
676 
677 }
678 
679 
680 #endif /* VVGL_GLBufferPool_hpp */
Buffer pools create and manage GL resources which, on deletion, are either destroyed or returned to t...
Definition: GLBufferPool.hpp:44
GLBufferRef CreateBufferForQImage(QImage *inImg, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
Creates and returns an OpenGL buffer from the passed QImage.
GLBufferRef 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).
GLBufferRef CreateRB(const Size &size, const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
Creates and returns an OpenGL renderbuffer.
Definition: GLBuffer.hpp:13
GLBufferRef 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 memo...
GLBufferRef CreateVAO(const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
Creates and returns a vertex attribte object (VAO).
GLBufferRef 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 backin...
GLBufferRef CreateCPUBufferForQVideoFrame(QVideoFrame *inFrame, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
Creates and returns a CPU-based buffer from the passed QVideoFrame.
GLBufferRef 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 inform...
STL namespace.
GLBufferRef 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 inform...
Basic struct for 2D size.
Definition: VVGL_Geom.hpp:46
GLContextRef & context()
Returns the GLContextRef used by the buffer pool to create and destroy its GL resources.
Definition: GLBufferPool.hpp:82
void timestampThisBuffer(const GLBufferRef &n) const
Timestamps the passed buffer with the current time.
Definition: GLBufferPool.hpp:80
GLBufferRef 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.
GLBufferRef 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 GLTexT...
GLBufferRef 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).
GLBufferRef 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 mem...
The Descriptor struct describes the hardware attributes of the GLBuffer.
Definition: GLBuffer.hpp:115
GLBufferRef 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...
GLBufferRef 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...
GLBufferRef CreateCPUBufferForQImage(QImage *inImg, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
Creates and returns a CPU-based buffer from the passed QImage.
function< void(GLBuffer &, void *)> BackingReleaseCallback
This defines a callback that is used to release the backing of a GLBuffer, where appropriate. The GLBuffer being released is the first var, and the GLBuffer&#39;s backingContext is the second var. The backingContext is probably a pointer to an object from another SDK that has been retained, and needs to be released/freed using the appropriate means.
Definition: GLBuffer.hpp:35
GLBufferRef 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 inform...
GLBufferRef 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 backin...
GLBufferRef 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 memo...
GLBufferRef 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 ...
GLBufferRef 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...
GLBufferRef 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 (...
GLBufferRef 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 inform...
InternalFormat
Definition: GLBuffer.hpp:12
GLBufferRef 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 (3...
GLBufferRef 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...
GLBufferRef CreateFBO(const bool &createInCurrentContext=false, const GLBufferPoolRef &inPoolRef=GetGlobalBufferPool())
Creates and returns a framebuffer object (FBO).
GLBufferRef 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 pla...
GLBufferRef 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.
GLBufferRef 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...
GLBufferRef 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.
Timestamp getTimestamp() const
Returns a timestamp generated for the current time.
Definition: GLBufferPool.hpp:78
GLBufferRef 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...