google-code-export / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

FIX for Sprite.draw() not working #575

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. load an image - img = pyglet.image.load("img.png")
2. create a sprite - spr = pyglet.sprite.Sprite(img)
3. draw the sprite - spr.draw()

What is expected:
The sprite with the image gets drawn on the screen.

What happens:
The sprite doesn't get drawn for some reason.

I have attached the output of info.py in the info.txt file.

Also I made a clone of this repository, and applied a fix described here:
http://stackoverflow.com/a/10368079/635587

It works for me now, but I haven't tested it on any other machine.
It should just work fine though on other systems too,
even if with a (very) minor performance penalty caused by the type conversion.

If you find this solution sufficient, please be so kind and pull this commit 
into the main tree.

https://code.google.com/r/torokati44-pyglet-sprite-fix/source/detail?r=9120cace4
5f75449a010489ce274dd2911b2d191

Original issue reported on code.google.com by torokati44 on 11 May 2012 at 5:23

Attachments:

GoogleCodeExporter commented 9 years ago
This patch seems innocuous--just creating a vertex list with float instead of 
ints. Anybody see a problem with it?

Original comment by winstonw...@gmail.com on 22 Jun 2012 at 9:31

GoogleCodeExporter commented 9 years ago
I think this is the same as issue 371. Alex H wanted to make floats an option 
to avoid sub-pixel artifacts.

Original comment by winstonw...@gmail.com on 22 Jun 2012 at 10:10

GoogleCodeExporter commented 9 years ago
I encountered this problem on a windows 7 laptop.

Video card: AMD Radeon HD 4680G
Driver version: 8.90.7-110915a-125898C

The patch fixed it.

Original comment by menkomigen6@gmail.com on 4 Oct 2013 at 9:41

GoogleCodeExporter commented 9 years ago
Hi,

I also encountered a similar problem on a windows 7 desktop.

Video card: Intel(R) HD Graphics 3000
Driver version: 9.17.10.3223

For me the sprite alone displays correctly. The problem arises when I try to 
add a label together with the sprite. I attach a minimal code which 
demonstrates my problem.

I noticed two things:
1. If I add one more letter to the label, the sprite appears. But a second 
additional letter and it disappears again.
2. If I increase the size of the image just above 128x128 (so at 129x129), the 
problem disappears.

If I apply the patch, problem is fixed.

Best regards,
Daniel.

Original comment by dan.gill...@gmail.com on 7 Oct 2013 at 8:53

Attachments:

GoogleCodeExporter commented 9 years ago
I think this issue is related to issue #371:

See: https://code.google.com/p/pyglet/issues/detail?id=371#c1

That issue has a patch in 
https://code.google.com/p/pyglet/issues/detail?id=371#c2 

Can you give it a go?

I'm going to close this issue and keep track of it in issue #371.

Original comment by useboxnet on 28 Nov 2013 at 7:49

GoogleCodeExporter commented 9 years ago
You have to pass `subpixel=True` parameter when creating the Sprite.

Original comment by useboxnet on 28 Nov 2013 at 7:56