1
\$\begingroup\$
image = pyglet.resource.image('spritesheet.png')
image.blit(0,0)

And

image = pyglet.resource.texture('spritesheet.png')
image.blit(0,0)

doing the same thing - they are drawing a spritesheet (or only one image), and they returns Texture type.

\$\endgroup\$
2
\$\begingroup\$

From the documentation (link):

pyglet.resource.texture is for loading stand-alone textures, and would be required when using the texture for a 3D model.

pyglet.resource.image is optimised for loading sprite-like images that can have their texture coordinates adjusted. The resource module attempts to pack small images into larger textures (called an atlas) for efficient rendering (which is why the return type of this function can be TextureRegion).

\$\endgroup\$
  • \$\begingroup\$ I thought that texture, spritesheet and atlas are synonyms. Images in a spritesheet have coordinates too. \$\endgroup\$ – neuro Apr 4 '16 at 17:15
  • \$\begingroup\$ A sprite sheets and atlases are basically the same things. One contains sprites and the other textures, which are all just images. pyglet.resource.image optimize the usage of small images by putting them in a sprite sheet. \$\endgroup\$ – Heckel Apr 4 '16 at 19:45
-3
\$\begingroup\$

Honestly, there is no difference. Both return the same thing and function the same exact way. It could just be personal preference, so choose what you want.

Cheers,

Bryce

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.