29 |
self.continuous = 1 |
self.continuous = 1 |
30 |
self.minfilter = "LINEAR_MIPMAP_LINEAR" |
self.minfilter = "LINEAR_MIPMAP_LINEAR" |
31 |
self.magfilter = "LINEAR" |
self.magfilter = "LINEAR" |
32 |
|
self.maxaniso = "" |
33 |
|
if gzz.gfx.gl.GL.hasExtension("GL_EXT_texture_filter_anisotropic"): |
34 |
|
self.maxaniso = "2.0" |
35 |
|
|
36 |
|
|
37 |
# Update from specified values |
# Update from specified values |
38 |
self.__dict__.update(dict) |
self.__dict__.update(dict) |
39 |
|
|
46 |
if not hasattr(self, "texture"): |
if not hasattr(self, "texture"): |
47 |
print "Generating texture: ", self.name, self.args |
print "Generating texture: ", self.name, self.args |
48 |
self.texture = getCachedTexture(self.args) |
self.texture = getCachedTexture(self.args) |
49 |
self.texture.setTexParameter("TEXTURE_2D", "TEXTURE_MIN_FILTER", self.minfilter) |
# XXX: FIXME: 1D/3D textures!!! |
50 |
self.texture.setTexParameter("TEXTURE_2D", "TEXTURE_MAG_FILTER", self.magfilter) |
target = "TEXTURE_2D" |
51 |
|
self.texture.setTexParameter(target, "TEXTURE_WRAP_S", "REPEAT") |
52 |
|
self.texture.setTexParameter(target, "TEXTURE_WRAP_T", "REPEAT") |
53 |
|
self.texture.setTexParameter(target, "TEXTURE_MIN_FILTER", self.minfilter) |
54 |
|
self.texture.setTexParameter(target, "TEXTURE_MAG_FILTER", self.magfilter) |
55 |
|
if (self.maxaniso and (self.minfilter + self.magfilter).find("NEAREST")): |
56 |
|
self.texture.setTexParameter(target, "TEXTURE_MAX_ANISOTROPY_EXT", self.maxaniso) |
57 |
|
|
58 |
return self.texture.getTexId() |
return self.texture.getTexId() |
59 |
|
|
60 |
def getName(self): |
def getName(self): |