DeferredRenderer 1.0

ScreenQuad Class Reference

A screenquad for drawing textures onto quads for projection. More...

#include <ScreenQuad.h>

List of all members.

Public Member Functions

 ScreenQuad ()
 ctor
 ScreenQuad (const float &_x, const float &_y, const float &_extent, const float &_depth)
 construct our screen quad with screen pos and extent
 ~ScreenQuad ()
 dtor
void genVAO ()
void draw (const std::string &_shaderName, unsigned int &_vao)
 draw the quad

Private Attributes

float m_x
 quad screen x value
float m_y
 quad screen y value
float m_extent
 quads size
float m_depth
 quad screen z value

Detailed Description

A screenquad for drawing textures onto quads for projection.

Definition at line 14 of file ScreenQuad.h.


Constructor & Destructor Documentation

ScreenQuad::ScreenQuad ( )

ctor

Definition at line 11 of file ScreenQuad.cpp.

{}
ScreenQuad::ScreenQuad ( const float &  _x,
const float &  _y,
const float &  _extent,
const float &  _depth 
)

construct our screen quad with screen pos and extent

Parameters:
[in]_xscreen X
[in]_yscreen Y
[in]_extentsize of quad
[in]_depththe screen depth

Definition at line 12 of file ScreenQuad.cpp.

References m_depth, m_extent, m_x, and m_y.

{
    m_x = _x;
    m_y = _y;
    m_depth = _depth;
    m_extent = _extent;
}
ScreenQuad::~ScreenQuad ( )

dtor

Definition at line 19 of file ScreenQuad.cpp.

{}

Member Function Documentation

void ScreenQuad::draw ( const std::string &  _shaderName,
unsigned int &  _vao 
)

draw the quad

Parameters:
[in]_shaderNameour screenquad shader
[in]_ourscreenquad vao id

Definition at line 21 of file ScreenQuad.cpp.

References m_depth, m_extent, m_x, and m_y.

{
    ngl::ShaderManager *shader = ngl::ShaderManager::instance();
    (*shader)[_shaderName]->use();

    shader->setShaderParam4f(_shaderName, "u_CentreDepthExtent",
                             m_x,
                             m_y,
                             m_depth,
                             m_extent);

    // now we bind back our vertex array object and draw
    glBindVertexArray(_vao);    // select first VAO

    glDrawArrays(GL_QUADS, 0, 4); // draw first object

    // go back to default just incase
    glEnableVertexAttribArray(0);
    glBindVertexArray(0);
}

Here is the caller graph for this function:

void ScreenQuad::genVAO ( )

Member Data Documentation

float ScreenQuad::m_depth [private]

quad screen z value

Definition at line 44 of file ScreenQuad.h.

float ScreenQuad::m_extent [private]

quads size

Definition at line 42 of file ScreenQuad.h.

float ScreenQuad::m_x [private]

quad screen x value

Definition at line 38 of file ScreenQuad.h.

float ScreenQuad::m_y [private]

quad screen y value

Definition at line 40 of file ScreenQuad.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines