JNGL
Classes | Public Member Functions | Static Public Member Functions | List of all members
FrameBuffer Class Reference

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 (int width, int height)
 Creates a framebuffer object with width times height pixels.
 
 FrameBuffer (const FrameBuffer &)=delete
 
FrameBufferoperator= (const FrameBuffer &)=delete
 
 FrameBuffer (FrameBuffer &&)=default
 
FrameBufferoperator= (FrameBuffer &&)=default
 
Context use () const
 
void draw (Vec2 position, const ShaderProgram *=nullptr) const
 Draws the framebuffer image to the screen.
 
void draw (double x, double y) 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. More...
 

Static Public Member Functions

static void clear ()
 Clear the framebuffer with the color set by jngl::setBackgroundColor. More...
 

Detailed Description

Image framebuffer object which can be rendered on.

Definition at line 20 of file framebuffer.hpp.

Member Function Documentation

◆ clear()

static void clear ( )
static

Clear the framebuffer with the color set by jngl::setBackgroundColor.

Deprecated:
use jngl::FrameBuffer::Context::clear(Color) instead

◆ getTextureID()

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.


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