1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-26 02:07:26 +00:00

Little fixup + use RGBA16f framebuffer

This commit is contained in:
fgenesis 2016-11-15 12:58:55 +01:00
parent ce869ba55a
commit 034cf6a69f
3 changed files with 9 additions and 14 deletions

View file

@ -71,7 +71,7 @@ void PostProcessingFX::disable(FXTypes type)
void PostProcessingFX::render() void PostProcessingFX::render()
{ {
if(!core->frameBuffer.isEnabled()) if(!core->frameBuffer.isInited())
return; return;
for (int i = 0; i < FXT_MAX; i++) for (int i = 0; i < FXT_MAX; i++)

View file

@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
FrameBuffer::FrameBuffer() FrameBuffer::FrameBuffer()
{ {
inited = false; inited = false;
enabled = false;
w = 0; w = 0;
h = 0; h = 0;
g_frameBuffer = 0; g_frameBuffer = 0;
@ -119,9 +118,10 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen)
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, // FIXME: check for GL_ARB_texture_float; otherwise stick with old format
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA16F_ARB,
width, height, width, height,
0, GL_BGR, GL_UNSIGNED_BYTE, 0 ); 0, GL_RGBA, GL_FLOAT, 0 );
// Put together // Put together
@ -138,6 +138,7 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen)
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
switch( status ) switch( status )
{ {
@ -153,7 +154,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen)
debugLog("Done"); debugLog("Done");
inited = true; inited = true;
enabled = true;
return true; return true;
#endif #endif
@ -164,7 +164,6 @@ void FrameBuffer::unloadDevice()
{ {
debugLog("frameBuffer::unloadDevice"); debugLog("frameBuffer::unloadDevice");
inited = false; inited = false;
enabled = false;
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
@ -218,6 +217,7 @@ void FrameBuffer::reloadDevice()
void FrameBuffer::startCapture() void FrameBuffer::startCapture()
{ {
assert(inited);
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
@ -229,6 +229,7 @@ void FrameBuffer::startCapture()
void FrameBuffer::endCapture() void FrameBuffer::endCapture()
{ {
assert(inited);
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
@ -238,6 +239,7 @@ void FrameBuffer::endCapture()
void FrameBuffer::bindTexture() void FrameBuffer::bindTexture()
{ {
assert(inited);
#ifdef BBGE_BUILD_FRAMEBUFFER #ifdef BBGE_BUILD_FRAMEBUFFER
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID ); glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID );
@ -245,8 +247,3 @@ void FrameBuffer::bindTexture()
#endif #endif
} }
void FrameBuffer::setEnabled(bool e)
{
enabled = e;
}

View file

@ -31,8 +31,6 @@ public:
~FrameBuffer(); ~FrameBuffer();
bool init(int width, int height, bool fitToScreen=false); bool init(int width, int height, bool fitToScreen=false);
bool isInited() { return inited; } bool isInited() { return inited; }
bool isEnabled() { return enabled; }
void setEnabled(bool e);
void startCapture(); void startCapture();
void endCapture(); void endCapture();
void bindTexture(); void bindTexture();
@ -51,7 +49,7 @@ protected:
unsigned g_depthRenderBuffer; unsigned g_depthRenderBuffer;
unsigned g_dynamicTextureID; unsigned g_dynamicTextureID;
int w,h; int w,h;
bool enabled, inited; bool inited;
}; };
#endif #endif