52 #include <ACG/GL/acg_glew.hh> 53 #include "ScreenQuad.hh" 54 #include <ACG/ShaderUtils/GLSLShader.hh> 55 #include <ACG/GL/GLError.hh> 56 #include <ACG/GL/globjects.hh> 78 glDeleteBuffers(1, &
vbo_);
112 glGenBuffers(1, &
vbo_);
114 glBindBuffer(GL_ARRAY_BUFFER,
vbo_);
115 glBufferData(GL_ARRAY_BUFFER,
sizeof(quad), quad, GL_STATIC_DRAW);
117 glBindBuffer(GL_ARRAY_BUFFER, 0);
127 glGetIntegerv(GL_CURRENT_PROGRAM, &curProg);
132 glUseProgram(curProg);
170 glBindBuffer(GL_ARRAY_BUFFER,
vbo_);
177 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
179 if (_numInstances < 1)
180 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
183 #ifdef GL_VERSION_3_1 184 glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, _numInstances);
186 std::cerr <<
"error: instanced ScreenQuad draw - outdated glew version" << std::endl;
187 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
206 glActiveTexture(GL_TEXTURE0);
207 glEnable(GL_TEXTURE_2D);
208 glBindTexture(GL_TEXTURE_2D, _texture);
Namespace providing different geometric functions concerning angles.
Class to define the vertex input layout.
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.
void deactivateShaderPipeline(GLSL::Program *_prog) const
void disable()
Resets to standard rendering pipeline.
static ScreenQuad & instance()
Get singleton instance.
void activateShaderPipeline(GLSL::Program *_prog) const
void activateFixedFunction() const
static void drawInstanced(int _count, GLSL::Program *_prog=0)
Draw the screen quad with instancing.
void addElement(const VertexElement *_pElement)
void deactivateFixedFunction() const
GLSL::Program * texDrawProg_
Simple texture drawing shader.
void intDraw(GLSL::Program *_prog, int _numInstances=0)
Internal draw function.
ScreenQuad()
Default constructor.
VertexDeclaration * decl_
vertex format of screen quad (float2 pos)
void init()
Initialize vbo and format.
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
GLSL::PtrProgram loadProgram(const char *vertexShaderFile, const char *tessControlShaderFile, const char *tessEvaluationShaderFile, const char *geometryShaderFile, const char *fragmentShaderFile, const GLSL::StringList *macros, bool verbose)
GLuint vbo_
vbo containing the quad in projected coordinates
void setUniform(const char *_name, GLint _value)
Set int uniform to specified value.
void use()
Enables the program object for using.