about summary refs log tree commit diff
path: root/src/engine/client/graphics_threaded.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2011-12-31 11:18:55 +0100
committerMagnus Auvinen <magnus.auvinen@gmail.com>2011-12-31 11:18:55 +0100
commit6e57620c2ca9042732d67134e2986a4ad96d2534 (patch)
treed5f7aa0cf266fe695ca3240f1b267b02104e51c7 /src/engine/client/graphics_threaded.cpp
parentb31abc40537bff7e159091ff61d5af442296c4d9 (diff)
downloadzcatch-6e57620c2ca9042732d67134e2986a4ad96d2534.tar.gz
zcatch-6e57620c2ca9042732d67134e2986a4ad96d2534.zip
added flags for mipmap generation on textures. fixes missing texts
Diffstat (limited to 'src/engine/client/graphics_threaded.cpp')
-rw-r--r--src/engine/client/graphics_threaded.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp
index 2b9147ff..21e9ef2f 100644
--- a/src/engine/client/graphics_threaded.cpp
+++ b/src/engine/client/graphics_threaded.cpp
@@ -163,9 +163,20 @@ public:
 
 		glGenTextures(1, &m_aTextures[pCommand->m_Slot]);
 		glBindTexture(GL_TEXTURE_2D, m_aTextures[pCommand->m_Slot]);
-		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
-		gluBuild2DMipmaps(GL_TEXTURE_2D, StoreOglformat, pCommand->m_Width, pCommand->m_Height, Oglformat, GL_UNSIGNED_BYTE, pCommand->m_pData);
+
+		if(pCommand->m_Flags&CCommandBuffer::TEXFLAG_NOMIPMAPS)
+		{
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+			glTexImage2D(GL_TEXTURE_2D, 0, StoreOglformat, pCommand->m_Width, pCommand->m_Height, 0, Oglformat, GL_UNSIGNED_BYTE, pCommand->m_pData);
+		}
+		else
+		{
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+			gluBuild2DMipmaps(GL_TEXTURE_2D, StoreOglformat, pCommand->m_Width, pCommand->m_Height, Oglformat, GL_UNSIGNED_BYTE, pCommand->m_pData);
+		}
+
 		mem_free(pCommand->m_pData);
 	}
 
@@ -760,6 +771,11 @@ int CGraphics_Threaded::LoadTextureRaw(int Width, int Height, int Format, const
 	Cmd.m_Format = ImageFormatToTexFormat(Format);
 	Cmd.m_StoreFormat = ImageFormatToTexFormat(StoreFormat);
 
+	// flags
+	Cmd.m_Flags = 0;
+	if(Flags&IGraphics::TEXLOAD_NOMIPMAPS)
+		Cmd.m_Flags |= CCommandBuffer::TEXFLAG_NOMIPMAPS;
+
 	// calculate memory usage
 	int PixelSize = 4;
 	if(Format == CImageInfo::FORMAT_RGB)