Skip to content

Commit

Permalink
fix for http:://github.com//issues/19
Browse files Browse the repository at this point in the history
  • Loading branch information
rec committed Dec 19, 2012
1 parent 78f02c3 commit 8f5f592
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pi3d/Texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ def _load_opengl(self):
opengles.glTexImage2D(GL_TEXTURE_2D, 0, RGBv, self.ix, self.iy, 0, RGBv,
GL_UNSIGNED_BYTE,
ctypes.string_at(self.image, len(self.image)))
opengles.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, c_float(GL_LINEAR_MIPMAP_LINEAR))
opengles.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, c_float(GL_LINEAR))
opengles.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
c_float(GL_LINEAR_MIPMAP_LINEAR))
opengles.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
c_float(GL_LINEAR))
opengles.glGenerateMipmap(GL_TEXTURE_2D)
opengles.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
opengles.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)


class Cache(object):
Expand All @@ -90,9 +92,9 @@ def __init__(self):
def clear(self):
self.cache = {}

def create(self, file_string, **kwds):
texture = self.cache.get(file_string, None)
def create(self, file_string, blend=False, flip=False, size=0):
texture = self.cache.get((file_string, blend, flip, size), None)
if not texture:
texture = Texture(file_string, **kwds)
texture = Texture(file_string, blend=blend, flip=blend, size=size)

This comment has been minimized.

Copy link
@paddywwoof

paddywwoof Dec 19, 2012

Collaborator

not tried to work out what this is doing but it looks odd to have flip=blend rather than flip=flip

self.cache[file_string] = texture
return texture

1 comment on commit 8f5f592

@rec
Copy link
Collaborator Author

@rec rec commented on 8f5f592 Dec 20, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crap - I tested, but clearly not enough.

I just checked in a fix for that! The advantage of having other eyes.

Please sign in to comment.