Loading...
Searching...
No Matches
juce::OpenGLFrameBuffer Class Reference

## Detailed Description

Creates an openGL frame buffer.

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

- juce_opengl/opengl/juce_OpenGLFrameBuffer.h

## Public Types

enum class | RowOrder { fromBottomUp , fromTopDown }

## Public Member Functions

| OpenGLFrameBuffer ()
| Creates an uninitialised buffer.
| ~OpenGLFrameBuffer ()
| Destructor.
bool | initialise (OpenGLContext &context, int width, int height)
| Tries to allocates a buffer of the given size.
bool | initialise (OpenGLContext &context, const Image &content)
| Tries to allocates a buffer containing a copy of a given image.
bool | initialise (OpenGLFrameBuffer &other)
| Tries to allocate a copy of another framebuffer.
void | release ()
| Releases the buffer, if one has been allocated.
void | saveAndRelease ()
| If the framebuffer is active, this will save a stashed copy of its contents in main memory, and will release the GL buffer.
bool | reloadSavedCopy (OpenGLContext &context)
| Restores the framebuffer content that was previously saved using saveAndRelease().
bool | isValid () const noexcept
| Returns true if a valid buffer has been allocated.
int | getWidth () const noexcept
| Returns the width of the buffer.
int | getHeight () const noexcept
| Returns the height of the buffer.
GLuint | getTextureID () const noexcept
| Returns the texture ID number for using this buffer as a texture.
bool | makeCurrentRenderingTarget ()
| Selects this buffer as the current OpenGL rendering target.
void | releaseAsRenderingTarget ()
| Deselects this buffer as the current OpenGL rendering target.
GLuint | getFrameBufferID () const noexcept
| Returns the ID of this framebuffer, or 0 if it isn't initialised.
void | clear (Colour colour)
| Clears the framebuffer with the specified colour.
void | makeCurrentAndClear ()
| Selects the framebuffer as the current target, and clears it to transparent.
bool | readPixels (PixelARGB *targetData, const Rectangle< int > &sourceArea, RowOrder)
| Reads an area of pixels from the framebuffer into a 32-bit ARGB pixel array.
bool | writePixels (const PixelARGB *srcData, const Rectangle< int > &targetArea, RowOrder)
| Writes an area of pixels into the framebuffer from a specified pixel array.

## Static Public Member Functions

static GLuint | getCurrentFrameBufferTarget () noexcept
| Returns the current frame buffer ID for the current context.

## Member Enums

## RowOrder

enum class juce::OpenGLFrameBuffer::RowOrder

strong

Enumerator
fromBottomUp |
fromTopDown |

## Constructors and Destructors

## OpenGLFrameBuffer()

juce::OpenGLFrameBuffer::OpenGLFrameBuffer | ( |  | ) |

Creates an uninitialised buffer.

To actually allocate the buffer, use initialise().

Referenced by initialise(), and writePixels().

## ~OpenGLFrameBuffer()

juce::OpenGLFrameBuffer::~OpenGLFrameBuffer | ( |  | ) |

Destructor.

## Member Functions

## initialise() [1/3]

bool juce::OpenGLFrameBuffer::initialise | ( | OpenGLContext & | context,
|  | int | width,
|  | int | height )

Tries to allocates a buffer of the given size.

Note that a valid openGL context must be selected when you call this method, or it will fail.

## initialise() [2/3]

bool juce::OpenGLFrameBuffer::initialise | ( | OpenGLContext & | context,
|  | const Image & | content )

Tries to allocates a buffer containing a copy of a given image.

Note that a valid openGL context must be selected when you call this method, or it will fail.

## initialise() [3/3]

bool juce::OpenGLFrameBuffer::initialise | ( | OpenGLFrameBuffer & | other | ) |

Tries to allocate a copy of another framebuffer.

References OpenGLFrameBuffer().

## release()

void juce::OpenGLFrameBuffer::release | ( |  | ) |

Releases the buffer, if one has been allocated.

Any saved state that was created with saveAndRelease() will also be freed by this call.

## saveAndRelease()

void juce::OpenGLFrameBuffer::saveAndRelease | ( |  | ) |

If the framebuffer is active, this will save a stashed copy of its contents in main memory, and will release the GL buffer.

After saving, the original state can be restored again by calling reloadSavedCopy().

## reloadSavedCopy()

bool juce::OpenGLFrameBuffer::reloadSavedCopy | ( | OpenGLContext & | context | ) |

Restores the framebuffer content that was previously saved using saveAndRelease().

## isValid()

bool juce::OpenGLFrameBuffer::isValid | ( |  | ) | const

noexcept

Returns true if a valid buffer has been allocated.

## getWidth()

int juce::OpenGLFrameBuffer::getWidth | ( |  | ) | const

noexcept

Returns the width of the buffer.

References getWidth().

Referenced by getWidth().

## getHeight()

int juce::OpenGLFrameBuffer::getHeight | ( |  | ) | const

noexcept

Returns the height of the buffer.

References getHeight().

Referenced by getHeight().

## getTextureID()

GLuint juce::OpenGLFrameBuffer::getTextureID | ( |  | ) | const

noexcept

Returns the texture ID number for using this buffer as a texture.

References getTextureID().

Referenced by getTextureID().

## makeCurrentRenderingTarget()

bool juce::OpenGLFrameBuffer::makeCurrentRenderingTarget | ( |  | ) |

Selects this buffer as the current OpenGL rendering target.

References makeCurrentRenderingTarget().

Referenced by makeCurrentRenderingTarget().

## releaseAsRenderingTarget()

void juce::OpenGLFrameBuffer::releaseAsRenderingTarget | ( |  | ) |

Deselects this buffer as the current OpenGL rendering target.

References releaseAsRenderingTarget().

Referenced by releaseAsRenderingTarget().

## getFrameBufferID()

GLuint juce::OpenGLFrameBuffer::getFrameBufferID | ( |  | ) | const

noexcept

Returns the ID of this framebuffer, or 0 if it isn't initialised.

References getFrameBufferID().

Referenced by getFrameBufferID().

## getCurrentFrameBufferTarget()

GLuint juce::OpenGLFrameBuffer::getCurrentFrameBufferTarget | ( |  | ) |

static noexcept

Returns the current frame buffer ID for the current context.

References getCurrentFrameBufferTarget().

Referenced by getCurrentFrameBufferTarget().

## clear()

void juce::OpenGLFrameBuffer::clear | ( | Colour | colour | ) |

Clears the framebuffer with the specified colour.

References clear().

Referenced by clear().

## makeCurrentAndClear()

void juce::OpenGLFrameBuffer::makeCurrentAndClear | ( |  | ) |

Selects the framebuffer as the current target, and clears it to transparent.

References makeCurrentAndClear().

Referenced by makeCurrentAndClear().

## readPixels()

bool juce::OpenGLFrameBuffer::readPixels | ( | PixelARGB * | targetData,
|  | const Rectangle< int > & | sourceArea,
|  | RowOrder | )

Reads an area of pixels from the framebuffer into a 32-bit ARGB pixel array.

The RowOrder parameter specifies the order of rows in the resulting array.

## writePixels()

bool juce::OpenGLFrameBuffer::writePixels | ( | const PixelARGB * | srcData,
|  | const Rectangle< int > & | targetArea,
|  | RowOrder | )

Writes an area of pixels into the framebuffer from a specified pixel array.

The RowOrder parameter specifies the order of rows in srcData.

References OpenGLFrameBuffer().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited