Browse Source

Set clamp address mode for all cube textures by default. In OpenGL mode seams may appear otherwise.

Lasse Öörni 12 years ago
parent
commit
fc0264e4b9

+ 6 - 4
Source/Engine/Graphics/Direct3D9/D3D9TextureCube.cpp

@@ -46,6 +46,11 @@ TextureCube::TextureCube(Context* context) :
     Texture(context),
     lockedLevel_(-1)
 {
+    // Default to clamp mode addressing
+    addressMode_[COORD_U] = ADDRESS_CLAMP;
+    addressMode_[COORD_V] = ADDRESS_CLAMP;
+    addressMode_[COORD_W] = ADDRESS_CLAMP;
+    
     for (unsigned i = 0; i < MAX_CUBEMAP_FACES; ++i)
         faceMemoryUse_[i] = 0;
 }
@@ -145,10 +150,7 @@ bool TextureCube::SetSize(int size, unsigned format, TextureUsage usage)
         usage_ |= D3DUSAGE_RENDERTARGET;
         pool_ = D3DPOOL_DEFAULT;
         
-        // Clamp mode addressing by default, nearest filtering, and mipmaps disabled
-        addressMode_[COORD_U] = ADDRESS_CLAMP;
-        addressMode_[COORD_V] = ADDRESS_CLAMP;
-        addressMode_[COORD_W] = ADDRESS_CLAMP;
+        // Nearest filtering and mipmaps disabled by default
         filterMode_ = FILTER_NEAREST;
         requestedLevels_ = 1;
     }

+ 6 - 4
Source/Engine/Graphics/OpenGL/OGLTextureCube.cpp

@@ -47,6 +47,11 @@ TextureCube::TextureCube(Context* context) :
 {
     target_ = GL_TEXTURE_CUBE_MAP;
     
+    // Default to clamp mode addressing
+    addressMode_[COORD_U] = ADDRESS_CLAMP;
+    addressMode_[COORD_V] = ADDRESS_CLAMP;
+    addressMode_[COORD_W] = ADDRESS_CLAMP;
+
     for (unsigned i = 0; i < MAX_CUBEMAP_FACES; ++i)
         faceMemoryUse_[i] = 0;
 }
@@ -150,10 +155,7 @@ bool TextureCube::SetSize(int size, unsigned format, TextureUsage usage)
             renderSurfaces_[i]->SetTarget(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i);
         }
         
-        // Clamp mode addressing by default, nearest filtering, and mipmaps disabled
-        addressMode_[COORD_U] = ADDRESS_CLAMP;
-        addressMode_[COORD_V] = ADDRESS_CLAMP;
-        addressMode_[COORD_W] = ADDRESS_CLAMP;
+        // Nearest filtering and mipmaps disabled by default
         filterMode_ = FILTER_NEAREST;
         requestedLevels_ = 1;
     }