You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create texture using the texture creator of a canvas let mut texture = creator.create_texture_target(PixelFormat::RGB24, 256, 240).unwrap();
However, there is no such const/enum called PixelFormat::RGB24.
Interestingly, it was mentioned in the documentation on create_texture_from_surface let surface = Surface::new(512, 512, PixelFormat::RGB24).unwrap();
What is preferred way to do this for sdl3?
The text was updated successfully, but these errors were encountered:
My solution for this is using PixelFormat::try_from(SDL_PIXELFORMAT_RGB24).unwrap(). This avoids the use of unsafe. For production code I suppose you should handle the case where the pixel format is not available, but I am just using unwrap here.
Took inspiration from a code example that I couldn't find back atm :(
I am trying to create texture using the texture creator of a canvas
let mut texture = creator.create_texture_target(PixelFormat::RGB24, 256, 240).unwrap();
However, there is no such const/enum called
PixelFormat::RGB24
.Interestingly, it was mentioned in the documentation on create_texture_from_surface
let surface = Surface::new(512, 512, PixelFormat::RGB24).unwrap();
What is preferred way to do this for sdl3?
The text was updated successfully, but these errors were encountered: