JNGL
Easy to use cross-platform 2D game library
|
Image framebuffer object which can be rendered on. More...
#include <jngl/FrameBuffer.hpp>
Classes | |
struct | Context |
Lifetime object when the FrameBuffer is in use. More... | |
Public Member Functions | |
FrameBuffer (Pixels width, Pixels height) | |
Creates a framebuffer object with width times height actual pixels. | |
FrameBuffer (ScaleablePixels width, ScaleablePixels height) | |
Creates a framebuffer object with width times height scalable pixels. | |
FrameBuffer (std::array< Pixels, 2 > size) | |
Creates a framebuffer object with size[0] times size[1] pixels. | |
FrameBuffer (const FrameBuffer &)=delete | |
FrameBuffer & | operator= (const FrameBuffer &)=delete |
FrameBuffer (FrameBuffer &&)=default | |
FrameBuffer & | operator= (FrameBuffer &&)=default |
Context | use () const |
Starts drawing on the FrameBuffer as long as Context is alive. | |
void | draw (Vec2 position, const ShaderProgram *=nullptr) const |
Draws the framebuffer image to the screen. | |
void | draw (double x, double y) const |
void | draw (Mat3 modelview, const ShaderProgram *=nullptr) const |
void | drawMesh (const std::vector< Vertex > &vertexes, const ShaderProgram *=nullptr) const |
Draws a list of triangles with the framebuffer's texture on it. | |
Vec2 | getSize () const |
Returns the size in screen pixels. | |
uint32_t | getTextureID () const |
Returns the OpenGL texture ID of the associated image buffer. | |
Static Public Member Functions | |
static void | clear () |
Clear the framebuffer with the color set by jngl::setBackgroundColor. | |
Image framebuffer object which can be rendered on.
Example:
Definition at line 35 of file FrameBuffer.hpp.
Context use | ( | ) | const |
Starts drawing on the FrameBuffer as long as Context is alive.
The modelview matrix gets adjusted so that (0, 0) is in the center of the FrameBuffer.
|
static |
Clear the framebuffer with the color set by jngl::setBackgroundColor.
uint32_t getTextureID | ( | ) | const |
Returns the OpenGL texture ID of the associated image buffer.
While this is an implementation detail, it can be useful if you want to draw the GL_TEXTURE_2D
object yourself or need to pass it to another library. The return type is equivalent to GLuint
.