about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
authorJoel de Vahl <joel@stalverk80.se>2007-07-22 11:46:25 +0000
committerJoel de Vahl <joel@stalverk80.se>2007-07-22 11:46:25 +0000
commit2165a728c25d804128933408cd8753c333be9ed3 (patch)
tree569fb839b90d58f1f87bc40811a150131e64b61e /src/engine/client
parent14745012f3ca67ce5296496c8cf4c39c67e368a0 (diff)
downloadzcatch-2165a728c25d804128933408cd8753c333be9ed3.tar.gz
zcatch-2165a728c25d804128933408cd8753c333be9ed3.zip
Discarded work on mipmaps.
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/gfx.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/engine/client/gfx.cpp b/src/engine/client/gfx.cpp
index e7ec3b37..d8b3041c 100644
--- a/src/engine/client/gfx.cpp
+++ b/src/engine/client/gfx.cpp
@@ -156,7 +156,7 @@ bool gfx_init()
 	
 	// create null texture, will get id=0
 	gfx_load_texture_raw(4,4,IMG_RGBA,null_texture_data);
-	
+
 	return true;
 }
 
@@ -222,7 +222,35 @@ int gfx_load_texture_raw(int w, int h, int format, const void *data)
 	
 	return tex;
 }
+/*
+int gfx_load_mip_texture_raw(int w, int h, int format, const void *data)
+{
+	// grab texture
+	int tex = first_free_texture;
+	first_free_texture = textures[tex].next;
+	textures[tex].next = -1;
+	
+	// set data and return
+	// TODO: should be RGBA, not BGRA
+	dbg_msg("gfx", "%d = %dx%d", tex, w, h);
+	dbg_assert(format == IMG_RGBA, "not an RGBA image");
 
+	unsigned mip_w = w;
+	unsigned mip_h = h;
+	unsigned level = 0;
+	const unsigned char *ptr = (const unsigned char*)data;
+	while(mip_w > 0 && mip_h > 0)
+	{
+		dbg_msg("gfx mip", "%d = %dx%d", level, mip_w, mip_h);
+		textures[tex].tex.data2d_mip(mip_w, mip_h, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, level, ptr);
+		level++;
+		ptr = ptr + mip_w*mip_h*4;
+		mip_w = mip_w>>1;
+		mip_h = mip_h>>1;
+	}
+	return tex;
+}
+*/
 // simple uncompressed RGBA loaders
 int gfx_load_texture(const char *filename)
 {