//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//
#endif
#include <simgear/compiler.h>
+#include <simgear/debug/logstream.hxx>
#include <plib/sg.h>
-#include <plib/ssg.h>
#include <simgear/screen/extensions.hxx>
#include <simgear/screen/RenderTexture.h>
-#include SG_GLU_H
+#include <osg/GLU>
#include "bbcache.hxx"
SGBbCache::SGBbCache(void) :
bbListCount(0),
- cacheSizeKb(0),
textureWH(0),
+ cacheSizeKb(0),
builtBBCount(0),
+ frameNumber(0),
rt(0),
rtAvailable(false),
- frameNumber(0),
maxImpostorRegenFrame(20)
{
}
SGBbCache::~SGBbCache(void) {
- if(rt)
- delete rt;
+ delete rt;
freeTextureMemory();
}
void SGBbCache::init(int cacheCount) {
+ GLint colorBits = 0;
+ glGetIntegerv( GL_BLUE_BITS, &colorBits );
rt = new RenderTexture();
// don't use default rtt on nvidia/win because of poor performance of glCopyTexSubImage2D
// wihtout default pattrib params - see opengl forum
- rt->Reset("rgba tex2D ctt");
+ if( colorBits < 8 )
+ rt->Reset("rgba=5,5,5,1 ctt");
+ else
+ rt->Reset("rgba ctt");
+
+// rt->Reset("rgba tex2D ctt");
// rt->Reset("rgba tex2D");
if( rt->Initialize(256, 256, true) ) {
+ SG_LOG(SG_ALL, SG_INFO, "bbcache:Initialize sucessfull");
if (rt->BeginCapture())
{
+ SG_LOG(SG_ALL, SG_INFO, "bbcache:BeginCapture sucessfull, RTT available");
rtAvailable = true;
glViewport(0, 0, 256, 256);
glMatrixMode(GL_PROJECTION);
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
rt->EndCapture();
- }
- }
+ } else
+ SG_LOG(SG_ALL, SG_WARN, "bbcache:BeginCapture failed, RTT not available for 3D clouds");
+ } else
+ SG_LOG(SG_ALL, SG_WARN, "bbcache:Initialize failed, RTT not available for 3D clouds");
if( cacheCount )
allocTextureMemory( cacheCount, 64 );