]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/bbcache.cxx
- remove the SG_GLxxxx_H #defines, since OSG provides its own versions
[simgear.git] / simgear / scene / sky / bbcache.cxx
index da84fbce25857432e0638e1f1408b58c7f0a2136..66b272750fc990337d0ac9cda689b1c0dec6bffd 100644 (file)
@@ -16,7 +16,7 @@
 //
 // 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.
 //
 //
 
 #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"
 
@@ -91,29 +90,35 @@ bool SGBbCache::allocTextureMemory(int cacheCount, int textureDimension) {
 
 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");