pyglet
pyglet copied to clipboard
cannot blit_into image
Describe the bug for some reason , image . blit_into( source , ...) calls an abstract method and throws exception.
System Information: this is for pyglet version 2.0.5
How To Reproduce here is the code:
import pyglet
from pyglet.gl import *
# Create the main window
window = pyglet.window.Window()
tex_big = pyglet.image.load('texture_RGBA.png').get_texture()
tex_small = pyglet.image.load('white_pixel.png').get_texture()
@window.event
def on_draw():
glClearColor(255,255,255,255)
# Clear the window
window.clear()
tex_big .blit_into (source=tex_small, x=0, y=0, z=0)
tex_big .blit (0,0,0)
#
# Start the event loop
pyglet.app.run()
The source has to be ImageData
, not a Texture
.
The source has to be
ImageData
, not aTexture
.
ah , this: tex_small.get_image_data() . then why it is not in the documentation , of blit_into ? I had tried in vain, with Image class equally. searched half the internet , and the error msg "cannot blit into texture" is not helpful at all.
I just tried and didn't have any issues.
Just replaced tex_small = pyglet.image.load('white_pixel.png').get_texture()
with tex_small = pyglet.image.load('white_pixel.png').get_image_data()
Windows 10 on 2.0.5
If you are still having issues, I would suggest uninstalling and re-install pyglet. If you still have issues, post the actual trace log with the error.
true, it works with get_imge_data() , seems this time, the bug is more in the documentation and error-msg, wich do not tell anything about it.