61 #include <ACG/GL/acg_glew.hh>
62 #include "ScreenQuad.hh"
63 #include <ACG/ShaderUtils/GLSLShader.hh>
64 #include <ACG/GL/GLError.hh>
65 #include <ACG/GL/globjects.hh>
87 glDeleteBuffers(1, &
vbo_);
121 glGenBuffers(1, &
vbo_);
123 glBindBuffer(GL_ARRAY_BUFFER,
vbo_);
124 glBufferData(GL_ARRAY_BUFFER,
sizeof(quad), quad, GL_STATIC_DRAW);
126 glBindBuffer(GL_ARRAY_BUFFER, 0);
136 glGetIntegerv(GL_CURRENT_PROGRAM, &curProg);
141 glUseProgram(curProg);
179 glBindBuffer(GL_ARRAY_BUFFER,
vbo_);
186 glPolygonMode(GL_FRONT, GL_FILL);
188 if (_numInstances < 1)
189 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
192 #ifdef GL_VERSION_3_1
193 glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, _numInstances);
195 std::cerr <<
"error: instanced ScreenQuad draw - outdated glew version" << std::endl;
196 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
215 glActiveTexture(GL_TEXTURE0);
216 glEnable(GL_TEXTURE_2D);
217 glBindTexture(GL_TEXTURE_2D, _texture);
void deactivateShaderPipeline(GLSL::Program *_prog) const
Namespace providing different geometric functions concerning angles.
ScreenQuad()
Default constructor.
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
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.
GLSL::PtrProgram loadProgram(const char *vertexShaderFile, const char *tessControlShaderFile, const char *tessEvaluationShaderFile, const char *geometryShaderFile, const char *fragmentShaderFile, const GLSL::StringList *macros, bool verbose)
void deactivateFixedFunction() const
VertexDeclaration * decl_
vertex format of screen quad (float2 pos)
GLSL::Program * texDrawProg_
Simple texture drawing shader.
static ScreenQuad & instance()
Get singleton instance.
void activateShaderPipeline(GLSL::Program *_prog) const
void use()
Enables the program object for using.
GLuint vbo_
vbo containing the quad in projected coordinates
void activateFixedFunction() const
void init()
Initialize vbo and format.
Class to define the vertex input layout.
void setUniform(const char *_name, GLint _value)
Set int uniform to specified value.
void disable()
Resets to standard rendering pipeline.
static void drawInstanced(int _count, GLSL::Program *_prog=0)
Draw the screen quad with instancing.
void intDraw(GLSL::Program *_prog, int _numInstances=0)
Internal draw function.
void addElement(const VertexElement *_pElement)