projects
/
laserbrain_demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of /home/nuclear/code/laserbrain/demo
[laserbrain_demo]
/
src
/
texture.cc
diff --git
a/src/texture.cc
b/src/texture.cc
index
f4f7cfe
..
3af8116
100644
(file)
--- a/
src/texture.cc
+++ b/
src/texture.cc
@@
-43,6
+43,17
@@
void bind_texture(Texture *tex, int tunit)
}
}
}
}
+int next_pow2(int x)
+{
+ x--;
+ x = (x >> 1) | x;
+ x = (x >> 2) | x;
+ x = (x >> 4) | x;
+ x = (x >> 8) | x;
+ x = (x >> 16) | x;
+ return x + 1;
+}
+
Image *Texture::default_img;
Image *Texture::default_img;
@@
-174,7
+185,7
@@
void Texture::create(int xsz, int ysz, TextureType textype, unsigned int ifmt)
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- switch(type) {
+ switch(textype) {
case TEX_2D:
glTexImage2D(GL_TEXTURE_2D, 0, glifmt_from_ifmt(ifmt), xsz, ysz, 0, fmt, type, 0);
break;
case TEX_2D:
glTexImage2D(GL_TEXTURE_2D, 0, glifmt_from_ifmt(ifmt), xsz, ysz, 0, fmt, type, 0);
break;