|
From: <axl...@us...> - 2009-08-01 02:46:11
|
Revision: 447
http://hgengine.svn.sourceforge.net/hgengine/?rev=447&view=rev
Author: axlecrusher
Date: 2009-08-01 02:46:05 +0000 (Sat, 01 Aug 2009)
Log Message:
-----------
fix and update vbos
Modified Paths:
--------------
Mercury2/src/MercuryFBO.cpp
Mercury2/src/MercuryFBO.h
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-08-01 02:45:23 UTC (rev 446)
+++ Mercury2/src/MercuryFBO.cpp 2009-08-01 02:46:05 UTC (rev 447)
@@ -8,7 +8,11 @@
MercuryFBO::MercuryFBO()
:m_fboID(0), m_depthBufferID(0), m_initiated(false), m_useDepth(false),m_useScreenSize(false), m_width(0),m_height(0), m_numTextures(0)
{
- for (uint8_t i = 0; i < 4; ++i) m_textures[i] = NULL;
+ for (uint8_t i = 0; i < 4; ++i)
+ {
+ m_textures[i] = NULL;
+ m_cbt[i] = RGB;
+ }
}
MercuryFBO::~MercuryFBO()
@@ -46,7 +50,7 @@
{
MString n = ssprintf("%s_%d", m_name.c_str(), i);
m_textures[i] = Texture::LoadDynamicTexture(n);
- m_textures[i]->MakeDynamic(m_width, m_height, RGBA, n);
+ m_textures[i]->MakeDynamic(m_width, m_height, m_cbt[i], n);
}
}
@@ -76,7 +80,8 @@
GLERRORCHECK;
}
*/
-void MercuryFBO::PreRender(const MercuryMatrix& matrix)
+
+void MercuryFBO::Render(const MercuryMatrix& matrix)
{
if ( !m_initiated ) Setup();
@@ -90,19 +95,14 @@
for (uint8_t i = 0; i < m_numTextures; ++i)
{
MString n = ssprintf("%s_%d", m_name.c_str(), i);
- m_textures[i]->MakeDynamic(m_width, m_height, RGBA, n);
+ m_textures[i]->MakeDynamic(m_width, m_height, m_cbt[i], n);
}
}
Bind();
CHECKFBO; //Incomplete FBO
GLERRORCHECK;
}
-
- MercuryNode::PreRender(matrix);
-}
-
-void MercuryFBO::Render(const MercuryMatrix& matrix)
-{
+
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fboID);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GLERRORCHECK;
@@ -160,6 +160,13 @@
if ( !node.Attribute("usescreensize").empty() )
m_useScreenSize = node.Attribute("usescreensize") == "true"?true:false;
+ for (uint8_t i = 0; i < m_numTextures; ++i)
+ {
+ MString aname = ssprintf("colorbyte%d", i);
+ if ( !node.Attribute(aname).empty() )
+ m_cbt[i] = ToColorByteType( ToUpper( node.Attribute(aname) ) );
+ }
+
MercuryNode::LoadFromXML(node);
}
Modified: Mercury2/src/MercuryFBO.h
===================================================================
--- Mercury2/src/MercuryFBO.h 2009-08-01 02:45:23 UTC (rev 446)
+++ Mercury2/src/MercuryFBO.h 2009-08-01 02:46:05 UTC (rev 447)
@@ -3,6 +3,7 @@
#include <MercuryNode.h>
#include <Texture.h>
+#include <RawImageData.h>
class MercuryFBO : public MercuryNode
{
@@ -10,7 +11,6 @@
MercuryFBO();
virtual ~MercuryFBO();
- virtual void PreRender(const MercuryMatrix& matrix);
virtual void Render(const MercuryMatrix& matrix);
virtual void PostRender(const MercuryMatrix& matrix);
@@ -19,7 +19,7 @@
inline void SetWidth(uint16_t width) { m_width = width; }
inline void SetHeight(uint16_t height) { m_height = height; }
inline void SetUseDepth(bool toggle) { m_useDepth = toggle; }
- inline void SetNumTextures(uint8_t x) { m_numTextures = x; }
+ inline void SetNumTextures(uint8_t x) { m_numTextures = MIN<uint8_t>(x,4); }
GENRTTI(MercuryFBO);
@@ -37,6 +37,7 @@
// uint32_t m_textureID[4];
MAutoPtr< Texture > m_textures[4];
uint8_t m_numTextures;
+ ColorByteType m_cbt[4];
// static uint32_t m_lastRendered;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|