Beatmup
Beatmup::GL::Program Class Reference

Regular OpenGL program. More...

#include <program.h>

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

Public Member Functions

 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

Regular OpenGL program.

Definition at line 229 of file program.h.

Constructor & Destructor Documentation

◆ Program() [1/2]

Program::Program ( const GraphicPipeline gpu)

Definition at line 500 of file program.cpp.

500 : AbstractProgram(gpu) {}
AbstractProgram(const AbstractProgram &)=delete
disabling copying constructor

◆ Program() [2/2]

Program::Program ( const GraphicPipeline gpu,
const VertexShader vertex,
const FragmentShader fragment 
)

Definition at line 503 of file program.cpp.

503  :
504  AbstractProgram(gpu)
505 {
506  link(vertex, fragment);
507 }
void link(const VertexShader &, const FragmentShader &)
Definition: program.cpp:510
JNIEnv jobject jint jint jint jfloat fragment

Member Function Documentation

◆ link()

void Program::link ( const VertexShader vertexShader,
const FragmentShader fragmentShader 
)

Definition at line 510 of file program.cpp.

510  {
511  glAttachShader(getHandle(), vertexShader.handle);
512  glAttachShader(getHandle(), fragmentShader.handle);
513  glLinkProgram(getHandle());
514  glDetachShader(getHandle(), vertexShader.handle);
515  glDetachShader(getHandle(), fragmentShader.handle);
516  assertLinked();
517  GL::GLException::check("program linking");
518  clearCaches();
519 }
handle_t getHandle() const
Definition: program.h:142
static void check(const std::string &info)
Definition: bgl.h:62
handle_t handle
Definition: program.h:79

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