pyglet icon indicating copy to clipboard operation
pyglet copied to clipboard

cannot blit_into image

Open emrum opened this issue 1 year ago • 4 comments

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()

emrum avatar Mar 06 '23 08:03 emrum

The source has to be ImageData, not a Texture.

caffeinepills avatar Mar 06 '23 21:03 caffeinepills

The source has to be ImageData, not a Texture.

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.

emrum avatar Mar 07 '23 01:03 emrum

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.

caffeinepills avatar Mar 07 '23 16:03 caffeinepills

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.

emrum avatar Mar 08 '23 01:03 emrum