Browse Source

automatic build

David Rose 17 years ago
parent
commit
94fcffdf1f

+ 4 - 8
panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx

@@ -1054,7 +1054,7 @@ framebuffer_copy_to_texture(Texture *tex, int z, const DisplayRegion *dr,
   nassertv(tc != (TextureContext *)NULL);
   nassertv(tc != (TextureContext *)NULL);
   TinyTextureContext *gtc = DCAST(TinyTextureContext, tc);
   TinyTextureContext *gtc = DCAST(TinyTextureContext, tc);
 
 
-  GLTexture *gltex = gtc->_gltex;
+  GLTexture *gltex = &gtc->_gltex;
   if (!setup_gltex(gltex, tex->get_x_size(), tex->get_y_size(), 1)) {
   if (!setup_gltex(gltex, tex->get_x_size(), tex->get_y_size(), 1)) {
     return;
     return;
   }
   }
@@ -1251,7 +1251,6 @@ prepare_texture(Texture *tex) {
   }
   }
 
 
   TinyTextureContext *gtc = new TinyTextureContext(_prepared_objects, tex);
   TinyTextureContext *gtc = new TinyTextureContext(_prepared_objects, tex);
-  gtc->_gltex = (GLTexture *)gl_zalloc(sizeof(GLTexture));
 
 
   return gtc;
   return gtc;
 }
 }
@@ -1268,11 +1267,9 @@ void TinyGraphicsStateGuardian::
 release_texture(TextureContext *tc) {
 release_texture(TextureContext *tc) {
   TinyTextureContext *gtc = DCAST(TinyTextureContext, tc);
   TinyTextureContext *gtc = DCAST(TinyTextureContext, tc);
 
 
-  GLTexture *gltex = gtc->_gltex;
-  gtc->_gltex = NULL;
-
   _texturing_state = 0;  // just in case
   _texturing_state = 0;  // just in case
 
 
+  GLTexture *gltex = &gtc->_gltex;
   for (int i = 0; i < gltex->num_levels; ++i) {
   for (int i = 0; i < gltex->num_levels; ++i) {
     gl_free(gltex->levels[i].pixmap);
     gl_free(gltex->levels[i].pixmap);
   }
   }
@@ -1281,7 +1278,6 @@ release_texture(TextureContext *tc) {
     gltex->levels = NULL;
     gltex->levels = NULL;
   }
   }
 
 
-  gl_free(gltex);
   gtc->dequeue_lru();
   gtc->dequeue_lru();
 
 
   delete gtc;
   delete gtc;
@@ -1720,7 +1716,7 @@ apply_texture(TextureContext *tc) {
 
 
   gtc->set_active(true);
   gtc->set_active(true);
 
 
-  GLTexture *gltex = gtc->_gltex;
+  GLTexture *gltex = &gtc->_gltex;
 
 
   if (gtc->was_image_modified() || gltex->num_levels == 0) {
   if (gtc->was_image_modified() || gltex->num_levels == 0) {
     // If the texture image was modified, reload the texture.
     // If the texture image was modified, reload the texture.
@@ -1767,7 +1763,7 @@ upload_texture(TinyTextureContext *gtc) {
 #ifdef DO_PSTATS
 #ifdef DO_PSTATS
   _data_transferred_pcollector.add_level(tex->get_ram_image_size());
   _data_transferred_pcollector.add_level(tex->get_ram_image_size());
 #endif
 #endif
-  GLTexture *gltex = gtc->_gltex;
+  GLTexture *gltex = &gtc->_gltex;
 
 
   int num_levels = 1;
   int num_levels = 1;
   if (tex->uses_mipmaps()) {
   if (tex->uses_mipmaps()) {

+ 1 - 2
panda/src/tinydisplay/tinyTextureContext.I

@@ -22,7 +22,6 @@ INLINE TinyTextureContext::
 TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex) :
 TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex) :
   TextureContext(pgo, tex), SimpleLruPage(0)
   TextureContext(pgo, tex), SimpleLruPage(0)
 {
 {
-  _gltex = NULL;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -32,7 +31,7 @@ TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex) :
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 INLINE TinyTextureContext::
 INLINE TinyTextureContext::
 ~TinyTextureContext() {
 ~TinyTextureContext() {
-  nassertv(_gltex == NULL);
+  nassertv(_gltex.levels == NULL);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 6 - 6
panda/src/tinydisplay/tinyTextureContext.cxx

@@ -36,14 +36,14 @@ void TinyTextureContext::
 evict_lru() {
 evict_lru() {
   dequeue_lru();
   dequeue_lru();
 
 
-  for (int i = 0; i < _gltex->num_levels; ++i) {
-    gl_free(_gltex->levels[i].pixmap);
+  for (int i = 0; i < _gltex.num_levels; ++i) {
+    gl_free(_gltex.levels[i].pixmap);
   }
   }
-  if (_gltex->levels != NULL) {
-    gl_free(_gltex->levels);
-    _gltex->levels = NULL;
+  if (_gltex.levels != NULL) {
+    gl_free(_gltex.levels);
+    _gltex.levels = NULL;
   }
   }
-  _gltex->num_levels = 0;
+  _gltex.num_levels = 0;
 
 
   set_resident(false);
   set_resident(false);
 }
 }

+ 2 - 3
panda/src/tinydisplay/tinyTextureContext.h

@@ -19,8 +19,7 @@
 #include "textureContext.h"
 #include "textureContext.h"
 #include "deletedChain.h"
 #include "deletedChain.h"
 #include "simpleLru.h"
 #include "simpleLru.h"
-
-struct GLTexture;
+#include "zgl.h"
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : TinyTextureContext
 //       Class : TinyTextureContext
@@ -36,7 +35,7 @@ public:
   INLINE void update_data_size_bytes(size_t new_data_size_bytes);
   INLINE void update_data_size_bytes(size_t new_data_size_bytes);
   virtual void evict_lru();
   virtual void evict_lru();
 
 
-  GLTexture *_gltex;
+  GLTexture _gltex;
 
 
 public:
 public:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {