Developer Documentation
Loading...
Searching...
No Matches
ACG::ScreenQuad Class Reference

#include <OpenFlipper/libs_required/ACG/GL/ScreenQuad.hh>

Public Member Functions

 ~ScreenQuad ()
 Destructor.
 

Static Public Member Functions

static void draw (GLSL::Program *_prog=0)
 Draw the screen quad.
 
static void drawInstanced (int _count, GLSL::Program *_prog=0)
 Draw the screen quad with instancing.
 
static void drawTexture2D (GLuint _texture, const Vec2f &_offset=Vec2f(0.0f, 0.0f), const Vec2f &_size=Vec2f(1.0f, 1.0f))
 Draw a 2D texture to screen.
 

Private Member Functions

 ScreenQuad ()
 Default constructor.
 
void init ()
 Initialize vbo and format.
 
void intDraw (GLSL::Program *_prog, int _numInstances=0)
 Internal draw function.
 

Static Private Member Functions

static ScreenQuadinstance ()
 Get singleton instance.
 

Private Attributes

GLuint vbo_
 vbo containing the quad in projected coordinates
 
VertexDeclarationdecl_
 vertex format of screen quad (float2 pos)
 
GLSL::ProgramtexDrawProg_
 Simple texture drawing shader.
 

Detailed Description

This class provides a simple method to draw a screen-aligned quad.

Definition at line 72 of file ScreenQuad.hh.

Constructor & Destructor Documentation

◆ ~ScreenQuad()

ACG::ScreenQuad::~ScreenQuad ( )

Destructor.

Definition at line 75 of file ScreenQuad.cc.

◆ ScreenQuad()

ACG::ScreenQuad::ScreenQuad ( )
private

Default constructor.

Definition at line 66 of file ScreenQuad.cc.

Member Function Documentation

◆ draw()

void ACG::ScreenQuad::draw ( GLSL::Program _prog = 0)
static

Draw the screen quad.

The quad is in projected space with coordinates in [-1, 1].

Parameters
_progGLSL shader to bind attribute id's if needed. Pass null-pointer for fixed function rendering

Definition at line 138 of file ScreenQuad.cc.

◆ drawInstanced()

void ACG::ScreenQuad::drawInstanced ( int  _count,
GLSL::Program _prog = 0 
)
static

Draw the screen quad with instancing.

Can be used for render to 2D-array / 3D volume The quad is in projected space with coordinates in [-1, 1].

Parameters
_countnumber of instances
_progGLSL shader to bind attribute id's if needed. Pass null-pointer for fixed function rendering

Definition at line 150 of file ScreenQuad.cc.

◆ drawTexture2D()

void ACG::ScreenQuad::drawTexture2D ( GLuint  _texture,
const Vec2f _offset = Vec2f(0.0f, 0.0f),
const Vec2f _size = Vec2f(1.0f, 1.0f) 
)
static

Draw a 2D texture to screen.

Useful for debugging, copying a texture..

Parameters
_textureTexture that should be bound when drawing the quad
_offsetOffset passed to the uniform called offset in the shader
_sizeSize passed to the uniform called size in the shader

Definition at line 197 of file ScreenQuad.cc.

◆ init()

void ACG::ScreenQuad::init ( )
private

Initialize vbo and format.

Definition at line 94 of file ScreenQuad.cc.

◆ instance()

ScreenQuad & ACG::ScreenQuad::instance ( )
staticprivate

Get singleton instance.

Definition at line 86 of file ScreenQuad.cc.

◆ intDraw()

void ACG::ScreenQuad::intDraw ( GLSL::Program _prog,
int  _numInstances = 0 
)
private

Internal draw function.

Definition at line 162 of file ScreenQuad.cc.

Member Data Documentation

◆ decl_

VertexDeclaration* ACG::ScreenQuad::decl_
private

vertex format of screen quad (float2 pos)

Definition at line 128 of file ScreenQuad.hh.

◆ texDrawProg_

GLSL::Program* ACG::ScreenQuad::texDrawProg_
private

Simple texture drawing shader.

Definition at line 132 of file ScreenQuad.hh.

◆ vbo_

GLuint ACG::ScreenQuad::vbo_
private

vbo containing the quad in projected coordinates

Definition at line 125 of file ScreenQuad.hh.


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