mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
83 lines
2.9 KiB
C++
83 lines
2.9 KiB
C++
/*
|
|
==============================================================================
|
|
|
|
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
|
Copyright 2004-11 by Raw Material Software Ltd.
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
JUCE can be redistributed and/or modified under the terms of the GNU General
|
|
Public License (Version 2), as published by the Free Software Foundation.
|
|
A copy of the license is included in the JUCE distribution, or can be found
|
|
online at www.gnu.org/licenses.
|
|
|
|
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
To release a closed-source product which uses JUCE, commercial licenses are
|
|
available: visit www.rawmaterialsoftware.com/juce for more information.
|
|
|
|
==============================================================================
|
|
*/
|
|
|
|
#ifndef __JUCE_OPENGLFRAMEBUFFER_JUCEHEADER__
|
|
#define __JUCE_OPENGLFRAMEBUFFER_JUCEHEADER__
|
|
|
|
|
|
//==============================================================================
|
|
/**
|
|
Creates an openGL frame buffer.
|
|
*/
|
|
class JUCE_API OpenGLFrameBuffer
|
|
{
|
|
public:
|
|
/** Creates an uninitialised buffer.
|
|
To actually allocate the buffer, use initialise().
|
|
*/
|
|
OpenGLFrameBuffer();
|
|
|
|
/** Destructor. */
|
|
~OpenGLFrameBuffer();
|
|
|
|
//==============================================================================
|
|
/** 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.
|
|
*/
|
|
bool initialise (int width, int height);
|
|
|
|
/** Releases the buffer, if one has been allocated. */
|
|
void release();
|
|
|
|
/** Returns true if a valid buffer has been allocated. */
|
|
bool isValid() const noexcept { return pimpl != nullptr; }
|
|
|
|
/** Returns the width of the buffer. */
|
|
int getWidth() const noexcept;
|
|
|
|
/** Returns the height of the buffer. */
|
|
int getHeight() const noexcept;
|
|
|
|
/** Returns the texture ID number for using this buffer as a texture. */
|
|
unsigned int getTextureID() const noexcept;
|
|
|
|
//==============================================================================
|
|
/** Selects this buffer as the current OpenGL rendering target. */
|
|
void makeCurrentTarget();
|
|
|
|
/** Deselects this buffer as the current OpenGL rendering target. */
|
|
void releaseCurrentTarget();
|
|
|
|
private:
|
|
class Pimpl;
|
|
friend class ScopedPointer<Pimpl>;
|
|
ScopedPointer<Pimpl> pimpl;
|
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLFrameBuffer);
|
|
};
|
|
|
|
|
|
#endif // __JUCE_OPENGLFRAMEBUFFER_JUCEHEADER__
|