Commit bdf1bbd3 authored by Robert Menzel's avatar Robert Menzel

added option to re-route default framebuffer to be not 0

parent 70de835d
...@@ -125,6 +125,12 @@ ...@@ -125,6 +125,12 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#if ACGL_OPENGL_VERSION > 32
// prevents QT from redefining the debug functions
#define GL_ARB_debug_output
#define GL_KHR_debug
#endif
void CHECKGLERROR(); void CHECKGLERROR();
#ifdef ACGL_OPENGL_ES #ifdef ACGL_OPENGL_ES
......
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
namespace ACGL{ namespace ACGL{
namespace OpenGL{ namespace OpenGL{
//! the set framebuffer will replace framebuffer 0
void setDefaultFramebuffer( GLuint _id );
//! can replace glBindFramebuffer( GL_FRAMEBUFFER, 0 ) if the window toolkit needs to use a FB != 0 as the default
void bindDefaultFramebuffer();
//! returns the size in bytes of the common gl types named by there GLenums (GL_BYTE, GL_UNSIGNED_INT etc.) //! returns the size in bytes of the common gl types named by there GLenums (GL_BYTE, GL_UNSIGNED_INT etc.)
//! returns 0 for unknown types, so be careful ;-) //! returns 0 for unknown types, so be careful ;-)
GLint getGLTypeSize ( GLenum _type ); GLint getGLTypeSize ( GLenum _type );
......
...@@ -293,7 +293,7 @@ SharedTextureData FrameBufferObject::getImageData(GLsizei _width, GLsizei _heigh ...@@ -293,7 +293,7 @@ SharedTextureData FrameBufferObject::getImageData(GLsizei _width, GLsizei _heigh
size_t paddingPerRow = ( packingAlignment - (bytesOfDataPerRow % packingAlignment) ) % packingAlignment; size_t paddingPerRow = ( packingAlignment - (bytesOfDataPerRow % packingAlignment) ) % packingAlignment;
GLubyte* frameBufferData = new GLubyte[_height * (bytesOfDataPerRow + paddingPerRow) ]; GLubyte* frameBufferData = new GLubyte[_height * (bytesOfDataPerRow + paddingPerRow) ];
glBindFramebuffer(GL_FRAMEBUFFER, 0); ACGL::OpenGL::bindDefaultFramebuffer();
#ifndef ACGL_OPENGLES_VERSION_20 #ifndef ACGL_OPENGLES_VERSION_20
if(_readBuffer != GL_INVALID_ENUM) if(_readBuffer != GL_INVALID_ENUM)
......
...@@ -15,6 +15,18 @@ using namespace std; ...@@ -15,6 +15,18 @@ using namespace std;
namespace ACGL{ namespace ACGL{
namespace OpenGL{ namespace OpenGL{
GLuint g_ACGL_defaultFramebuffer = 0;
void setDefaultFramebuffer( GLuint _id )
{
g_ACGL_defaultFramebuffer = _id;
}
void bindDefaultFramebuffer()
{
glBindFramebuffer( GL_FRAMEBUFFER, g_ACGL_defaultFramebuffer );
}
#if (ACGL_OPENGL_VERSION >= 30) #if (ACGL_OPENGL_VERSION >= 30)
bool doesSupportExtension( const char *_extensionName ) bool doesSupportExtension( const char *_extensionName )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment