Announcing the SDL_image 3.3 Preview!

This is a preview of the upcoming 3.4 release!

3 Likes

This has been updated to 3.3.4, with functions to load images into GPU textures:

2 Likes

Awesome, waiting for Odin Vendor libs to add this.

I was searching for something like IMG_LoadGPUTexture() .

Here’s what I have in my current project:

// Surface is CPU Bound, use it if you want to manipulate it.
// Like Alpha Pre multiplication.
// Replace with STBI
surface := img.Load(texture_file); assert(surface != nil)
defer sdl.DestroySurface(surface)
width  := u32(surface.w)
height := u32(surface.h)
pixels_byte_size := width * height * 4

texture := sdl.CreateGPUTexture(
	g.gpu,
	{
		type                 = .D2,
		format               = .R8G8B8A8_UNORM_SRGB,
		usage                = {.SAMPLER},
		width                = width,
		height               = height,
		layer_count_or_depth = 1,
		num_levels           = 1,
	},
)

Thank You @slouken