openMSX
|
Wrapper around a pixel buffer. More...
#include <GLUtil.hh>
Public Member Functions | |
PixelBuffer () | |
PixelBuffer (const PixelBuffer &other)=delete | |
PixelBuffer (PixelBuffer &&other) noexcept | |
PixelBuffer & | operator= (const PixelBuffer &other)=delete |
PixelBuffer & | operator= (PixelBuffer &&other) noexcept |
~PixelBuffer () | |
void | setImage (GLuint width, GLuint height) |
Sets the image for this buffer. | |
void | bind () const |
Bind this PixelBuffer. | |
void | unbind () const |
Unbind this buffer. | |
T * | getOffset (GLuint x, GLuint y) |
Gets a pointer relative to the start of this buffer. | |
T * | mapWrite () |
Maps the contents of this buffer into memory. | |
void | unmap () const |
Unmaps the contents of this buffer. | |
Wrapper around a pixel buffer.
The pixel buffer will be allocated in VRAM if possible, in main RAM otherwise. The pixel type is templatized T.
Note: openGL ES 2.0 does not yet support this. So for now we always use the fallback implementation, maybe we can re-enable this when we switch to openGL ES 3.0.
gl::PixelBuffer< T >::PixelBuffer | ( | ) |
|
delete |
|
noexcept |
gl::PixelBuffer< T >::~PixelBuffer | ( | ) |
void gl::PixelBuffer< T >::bind | ( | ) | const |
Bind this PixelBuffer.
Must be called before the methods getOffset() or mapWrite() are used. (Is a wrapper around glBindBuffer).
Definition at line 278 of file GLUtil.hh.
Referenced by openmsx::GLHQLiteScaler::uploadBlock(), and openmsx::GLHQScaler::uploadBlock().
T * gl::PixelBuffer< T >::getOffset | ( | GLuint | x, |
GLuint | y | ||
) |
Gets a pointer relative to the start of this buffer.
You must not dereference this pointer, but you can pass it to glTexImage etc when this buffer is bound as the source.
Definition at line 294 of file GLUtil.hh.
Referenced by openmsx::GLHQLiteScaler::uploadBlock(), and openmsx::GLHQScaler::uploadBlock().
T * gl::PixelBuffer< T >::mapWrite | ( | ) |
Maps the contents of this buffer into memory.
The returned buffer is write-only (reading could be very slow or even result in a segfault).
Definition at line 307 of file GLUtil.hh.
Referenced by openmsx::GLHQLiteScaler::uploadBlock(), and openmsx::GLHQScaler::uploadBlock().
|
delete |
|
noexcept |
void gl::PixelBuffer< T >::setImage | ( | GLuint | width, |
GLuint | height | ||
) |
Sets the image for this buffer.
TODO: Actually, only image size for now; later, if we need it, image data too.
Definition at line 260 of file GLUtil.hh.
Referenced by openmsx::GLHQLiteScaler::GLHQLiteScaler(), and openmsx::GLHQScaler::GLHQScaler().
void gl::PixelBuffer< T >::unbind | ( | ) | const |
Unbind this buffer.
Definition at line 286 of file GLUtil.hh.
Referenced by openmsx::GLHQLiteScaler::uploadBlock(), and openmsx::GLHQScaler::uploadBlock().
void gl::PixelBuffer< T >::unmap | ( | ) | const |
Unmaps the contents of this buffer.
After this call, you must no longer use the pointer returned by mapWrite.
Definition at line 318 of file GLUtil.hh.
Referenced by openmsx::GLHQLiteScaler::uploadBlock(), and openmsx::GLHQScaler::uploadBlock().