Skip to content

Update examples to use Image::new_target_texture instead of manual image creation when possible#23715

Open
doonv wants to merge 2 commits intobevyengine:mainfrom
doonv:use-image-new_target_texture
Open

Update examples to use Image::new_target_texture instead of manual image creation when possible#23715
doonv wants to merge 2 commits intobevyengine:mainfrom
doonv:use-image-new_target_texture

Conversation

@doonv
Copy link
Copy Markdown
Contributor

@doonv doonv commented Apr 8, 2026

Objective

Fix #19101. (Kinda, this is not the exact solution proposed in that issue, but it still shortens most of the examples)

Solution

Most of the images created in examples are for use in render targets. Image::new_target_texture is made for exactly that and significantly shortens the image creation process.

Testing

I tested all the examples I changed and they seem to work fine.


btw for some reason most of the examples use TextureFormat::Bgra8UnormSrgb while the documentation for Image::new_target_texture recommends TextureFormat::Rgba8UnormSrgb for SDR images. What's up with that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider builder pattern for adding images

1 participant