简体   繁体   English

pyglet精灵/纹理问题:从左下方延伸

[英]pyglet sprite/texture issue: stretched from bottom left

I have a problem with pyglet on one of my notebooks. 我的一个笔记本上的pyglet出现问题。 I'm working on a relatively complex 2D-Game but it occurs even with the most minimalistic pyglet application you can imagine: 我正在开发一个相对复杂的2D游戏,但即使使用您可以想象的最简约的pyglet应用程序,它也会发生:

import pyglet

if __name__ == '__main__':
    window = pyglet.window.Window(width=100, height=100)
    window.clear()

    ball_img = pyglet.image.load('ball.gif')
    ball = pyglet.sprite.Sprite(ball_img)

    @window.event
    def on_draw():
        ball.draw()

    pyglet.app.run()

It should display an image of a ball like this: 它应该显示一个像这样的球的图像:

预期的结果,一个球

But what it's drawing is a somehow stretched image: 但是它绘制的是某种程度的拉伸图像:

实际结果,拉长球

If I replace ball.draw() with ball_img.blit(0, 0, 0) it gets rendered as expected. 如果我用ball.draw()替换ball.draw()ball_img.blit(0, 0, 0)按预期方式呈现。

The notebook is a small Thinkpad X40 running Linux (Intel integrated graphics). 笔记本电脑是运行Linux(Intel集成显卡)的小型Thinkpad X40。

How can such a behaviour be caused or what is likely to be causing this? 如何导致这种行为或可能导致这种行为的原因?

On my laptop (Ubuntu 10.10 with Intel GMA 4500) everything works fine with your code. 在我的笔记本电脑上(配备Intel GMA 4500的Ubuntu 10.10),所有代码均可正常运行。 I just modified the image name and I used a png that I already had on the computer. 我刚刚修改了图像名称,并使用了计算机上已有的png。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM