25 #include "glfRenderTarget.hh"
26 #include "glfException.hh"
34 glClearColor(red, green, blue, alpha);
36 glClear(GL_COLOR_BUFFER_BIT);
38 GLF_THROW_ON_OPENGL_ERROR;
45 glClear(GL_DEPTH_BUFFER_BIT);
47 GLF_THROW_ON_OPENGL_ERROR;
53 glClearAccum(red, green, blue, alpha);
54 glClear(GL_ACCUM_BUFFER_BIT);
56 GLF_THROW_ON_OPENGL_ERROR;
63 glClear(GL_STENCIL_BUFFER_BIT);
65 GLF_THROW_ON_OPENGL_ERROR;
81 format = GL_DEPTH_COMPONENT;
85 format = GL_STENCIL_INDEX;
89 GLF_THROW_EXCEPTION(
"Invalid grab source");
96 switch (storageType) {
98 type = GL_UNSIGNED_BYTE;
104 type = GL_UNSIGNED_SHORT;
110 type = GL_UNSIGNED_INT;
119 GLF_THROW_EXCEPTION(
"Invalid storage type for ReadPixels");
127 image.
Init(width, height, numChannels, storageType);
130 glReadPixels(x, y, width, height, format, type, image.
GetImageData());
(16bit) unsigned integer image storage type
bool IsEmpty() const
check if ImageData_ points to allocated image buffer or not
(8bit) signed char image storage type
void ReadBuffer(BIAS::ImageBase &image, BufferType bufferType, int x, int y, int width, int height)
Copies the contents of a buffer to an image.
(16bit) signed integer image storage type
const void * GetImageData() const
void ClearAccumBuffer(float red=0.0f, float green=0.0f, float blue=0.0f, float alpha=0.0f)
Clears the accumulation buffer of the render target with the given color.
void ClearDepthBuffer(float depth=1.0f)
Clears the depth buffer of the render target with the given value.
void Release(const bool reset_storage_type=false)
Free the allocated data structures Hands off: Do !!NOT!! change the default of reset_storage_type: Im...
(32bit) signed integer image storage type
void Init(unsigned int width, unsigned int height, unsigned int nChannels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
Initialize image size and channels.
enum EStorageType GetStorageType() const
(8bit) unsigned char image storage type
void ClearStencilBuffer(int s=0)
Clears the stencil buffer of the render target with the given value.
void ClearColorBuffer(float red=0.0f, float green=0.0f, float blue=0.0f, float alpha=0.0f)
Clears the color buffer of the render target with the given color.
This is the base class for images in BIAS.
(32bit) unsigned integer image storage type