Skip to content

Instantly share code, notes, and snippets.

@beugnen
Created May 20, 2012 01:33
Show Gist options
  • Save beugnen/2733160 to your computer and use it in GitHub Desktop.
Save beugnen/2733160 to your computer and use it in GitHub Desktop.
Draw Screen Quad
void MyDualFramebufferView::RenderToMainscreen(IDrawable& drawable)
{
// switch back to main
glClearColor(1, 0, 0, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// trigger mipmaps generation explicitly
glBindTexture(GL_TEXTURE_2D, _fboTextureID);
glGenerateMipmap(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture ( GL_TEXTURE0 );
glUniform1i ( _basicArgs.Uniforms[UNIFORM_BASIC_SAMPLER0], 0 );
glVertexAttribPointer (ATTRIBUTE_BASIC_POSITION, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), _screenQuadVertices );
glVertexAttribPointer (ATTRIBUTE_BASIC_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), &_screenQuadVertices[3] );
glEnableVertexAttribArray (ATTRIBUTE_BASIC_POSITION);
glEnableVertexAttribArray (ATTRIBUTE_BASIC_TEX_COORD);
glBindTexture(GL_TEXTURE_2D, _fboTextureID);
glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, _screenQuadIndices );
glBindTexture(GL_TEXTURE_2D, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment