On Thursday, January 1, 2015 at 12:54:46 PM UTC+1, Salvakiya wrote: > > I am relatively new to python and am creating a game engine called PyGM. I > am trying to create Game Maker logic in Python. I chose Pyglet to handle > the graphics on this project however I have run into a few issues. > > The first issue was I could not scale a sprite without it becoming blurry > due to the biliniar texture filtering. After some research I found a fix by > using this code: > > def texture_set_mag_filter_nearest(texture): > glBindTexture(texture.target, texture.id) > glTexParameteri(texture.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST) > glBindTexture(texture.target, 0) > > there is however another issue. The sprites look fine when scaled to a > whole number but when scaling to anything else(like 2.5) produces strange > results. > > Is there a way to fix this? >
I don't know the solution to your problem, but I cannot get your code to work. It still scales using bilinear filtering for me. I am loading images using pyglet.resource.image (which returns a Texture). At this point I apply the code to each returned texture. Then I put these texture in sprites, scale it to 2, and put the sprites in a batch and draw them. As far as I can tell, the openGL target of these textures is GL_TEXTURE_RECTANGLE, and not GL_TEXTURE_2D. If I could change it to be GL_TEXTURE_2D , I think I could get it working as others have done (http://gamedev.stackexchange.com/questions/20297/how-can-i-resize-pixel-art-in-pyglet-without-making-it-blurry) But trying to manually change the target of each texture makes the program crash when I draw the batch: File "C:\Python34\lib\site-packages\pyglet\sprite.py", line 144, in set_state glBindTexture(self.texture.target, self.texture.id) File "C:\Python34\lib\site-packages\pyglet\gl\lib.py", line 104, in errcheck raise GLException(msg) pyglet.gl.lib.GLException: b'invalid operation' Any ideas what I'm doing wrong? -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
