Beatmup
Beatmup::GL::RenderingProgram Class Reference

GLSL program to render images Makes use of default vertex attributes to pass the texture coordinates and the image position to the GPU. More...

#include <program.h>

Inheritance diagram for Beatmup::GL::RenderingProgram:
Beatmup::GL::Program Beatmup::GL::AbstractProgram Beatmup::GL::RecycleBin::Item

Public Member Functions

 RenderingProgram (const GraphicPipeline &gpu, const FragmentShader &)
 
 RenderingProgram (const GraphicPipeline &gpu, const VertexShader &, const FragmentShader &)
 
void link (const GraphicPipeline &gpu, const FragmentShader &)
 
void blend (bool onScreen)
 
void blend ()
 
- Public Member Functions inherited from Beatmup::GL::Program
 Program (const GraphicPipeline &gpu)
 
 Program (const GraphicPipeline &gpu, const VertexShader &, const FragmentShader &)
 
void link (const VertexShader &, const FragmentShader &)
 
- Public Member Functions inherited from Beatmup::GL::AbstractProgram
 AbstractProgram (const GraphicPipeline &gpu)
 
 ~AbstractProgram ()
 
void enable (const GraphicPipeline &gpu)
 
ChunkgetBinary () const
 
void loadBinary (const Chunk &binary)
 
handle_t findUniformLocation (const char *name)
 Retrieves uniform variable location by its name. More...
 
handle_t findAttribLocation (const char *name)
 Retrieves attribute location by its name. More...
 
handle_t getUniformLocation (const std::string &name)
 Retrieves uniform variable location by its name. More...
 
handle_t getAttribLocation (const std::string &name)
 Retrieves attribute location by its name. More...
 
void setInteger (const std::string &name, const int value, bool safe=false)
 Assigns a value to a specific integer variable in the program. More...
 
void setUnsignedInteger (const std::string &name, const unsigned int value, bool safe=false)
 
void setFloat (const std::string &name, const float value, bool safe=false)
 Assigns a value to a specific floating point variable in the program. More...
 
void setVector2 (const std::string &name, const float x, const float y)
 
void setVector3 (const std::string &name, const float x, const float y, const float z)
 
void setVector4 (const std::string &name, const float x, const float y, const float z, const float w)
 
void setVector4 (const std::string &name, const color4i &color, const float outRange=1.0f)
 
void setMatrix2 (const std::string &name, const Matrix2 &mat)
 
void setMatrix3 (const std::string &name, const Matrix2 &mat, const Point &pos)
 
void setMatrix3 (const std::string &name, const AffineMapping &mapping)
 
void setIntegerArray (const std::string &name, const int *values, const int length)
 
void setIntegerArray (const std::string &name, const int firstValue, const int length)
 
void setFloatArray (const std::string &name, const float *values, const int length)
 
void setVec2Array (const std::string &name, const float *xy, const int length)
 
void setVec4Array (const std::string &name, const float *xyzw, const int length)
 
void bindSampler (GraphicPipeline &gpu, GL::TextureHandler &image, const char *uniformId, TextureParam param)
 
void bindImage (GraphicPipeline &gpu, GL::TextureHandler &image, const char *uniformId, bool read, bool write)
 
void bindAtomicCounter (GraphicPipeline &gpu, AtomicCounter &counter, int unit)
 
- Public Member Functions inherited from Beatmup::GL::RecycleBin::Item
 Item ()
 
virtual ~Item ()
 

Additional Inherited Members

- Protected Member Functions inherited from Beatmup::GL::AbstractProgram
handle_t getHandle () const
 
void assertLinked () const
 
void clearCaches ()
 

Detailed Description

GLSL program to render images Makes use of default vertex attributes to pass the texture coordinates and the image position to the GPU.

Definition at line 240 of file program.h.

Constructor & Destructor Documentation

◆ RenderingProgram() [1/2]

RenderingProgram::RenderingProgram ( const GraphicPipeline gpu,
const FragmentShader fragmentShader 
)

Definition at line 522 of file program.cpp.

522  :
523  RenderingProgram(gpu, gpu.getDefaultVertexShader(), fragmentShader)
524 {}
RenderingProgram(const GraphicPipeline &gpu, const FragmentShader &)
Definition: program.cpp:522
const GL::VertexShader & getDefaultVertexShader() const
Definition: pipeline.h:126

◆ RenderingProgram() [2/2]

RenderingProgram::RenderingProgram ( const GraphicPipeline gpu,
const VertexShader vertexShader,
const FragmentShader fragmentShader 
)

Definition at line 527 of file program.cpp.

527  :
528  Program(gpu)
529 {
532 
533  // link
534  Program::link(vertexShader, fragmentShader);
535 
536  // setting common stuff
537  enable(gpu);
540 }
static const AffineMapping IDENTITY
Definition: geometry.h:717
handle_t getHandle() const
Definition: program.h:142
void setInteger(const std::string &name, const int value, bool safe=false)
Assigns a value to a specific integer variable in the program.
Definition: program.cpp:308
void enable(const GraphicPipeline &gpu)
Definition: program.cpp:250
void setMatrix3(const std::string &name, const Matrix2 &mat, const Point &pos)
Definition: program.cpp:402
Program(const GraphicPipeline &gpu)
Definition: program.cpp:500
void link(const VertexShader &, const FragmentShader &)
Definition: program.cpp:510
static const char * TEXTURE_COORD_ATTRIB_NAME
texture coordinate attribute name in vertex shaders
static const char * VERTEX_COORD_ATTRIB_NAME
vertex coordinate attribute name in vertex shaders
static const char * VERTICAL_FLIP_ID
Vertical flipping variable name in vertex shader.
static const char * MODELVIEW_MATRIX_ID
Modelview matrix (mapping input geometry to output) shader variable name in vertex shader.
static const int ATTRIB_TEXTURE_COORD
texture coordinate attribute index in the VBO
Definition: pipeline.h:67
static const int ATTRIB_VERTEX_COORD
vertex coordinate attribute index in the VBO
Definition: pipeline.h:66

Member Function Documentation

◆ link()

void RenderingProgram::link ( const GraphicPipeline gpu,
const FragmentShader fragmentShader 
)

Definition at line 543 of file program.cpp.

543  {
544  Program::link(gpu.getDefaultVertexShader(), fragmentShader);
545 }

◆ blend() [1/2]

void RenderingProgram::blend ( bool  onScreen)

Definition at line 548 of file program.cpp.

548  {
550  blend();
551 }

◆ blend() [2/2]

void RenderingProgram::blend ( )

Definition at line 554 of file program.cpp.

554  {
555  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
556 }

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