summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2002-12-09 17:10:02 +0000
committerpixel <pixel>2002-12-09 17:10:02 +0000
commitdd1e9ef7dd0d490f9397d524e1cfde13d6314623 (patch)
tree406605e9a3515b027492d07bc28580db3ff38706 /lib
parent6529df93b5c53d11ce081272d292fb6b2c9b1101 (diff)
Zou
Diffstat (limited to 'lib')
-rw-r--r--lib/gltexture.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/gltexture.cc b/lib/gltexture.cc
index 2758c05..f33fe98 100644
--- a/lib/gltexture.cc
+++ b/lib/gltexture.cc
@@ -4,6 +4,8 @@
#include <generic.h>
#include "gltexture.h"
+#define DEBUG 1
+
#ifdef TRACE_TEXTURES
mogltk::texture * mogltk::texture::header = 0;
mogltk::texture * mogltk::texture::footer = 0;
@@ -81,12 +83,23 @@ void mogltk::texture::Generate() {
}
glGenTextures(1, &tex);
+#ifdef DEBUG
+ printm(M_INFO, "Generated texture index: %i\n", tex);
+#endif
+
+ glBindTexture(GL_TEXTURE_2D, tex);
if (planar) {
+#ifdef DEBUG
+ printm(M_INFO, "Generating planar texture: %i\n", tex);
+#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels);
} else {
+#ifdef DEBUG
+ printm(M_INFO, "Generating 3D texture: %i\n", tex);
+#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -103,6 +116,9 @@ void mogltk::texture::Bind(bool expand) {
if ((!texture_allocated) || tainted)
Generate();
glEnable(GL_TEXTURE_2D);
+#ifdef DEBUG
+ printm(M_INFO, "Binding texture index %i\n", tex);
+#endif
glBindTexture(GL_TEXTURE_2D, tex);
if (expand) {
glMatrixMode(GL_TEXTURE);