Skip to content

Using ktxTexture_SetImageFromStdioStream and ktxTexture_SetImageFromMemory to create a ktx2 file from a png file. #964

Closed Answered by MarkCallow
Galo32 asked this question in Q&A
Discussion options

You must be logged in to vote

1- ktxTexture_SetImageFromMemory function expects the src parametter to point to memory with the entire file or only need the texels/pixels data? I mean, src= [PNG FILE] or src = [pixel0, pixel1, pixel2, ...].

src is a pointer to the decoded image (i.e. the raw pixel data) in memory.

2- What's about srcSize?

It is the byte size of the image: width * height * bytes_per_pixel.

3- ktxTexture_SetImageFromStdioStream function expect the src parametter to be a valid FILE* or what?

A valid FILE* with its read pointer set to start of decoded image data. This function is not useful with a PNG file as you need to decode the data before passing it to libktx. There the data will already be load…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Galo32
Comment options

@MarkCallow
Comment options

Answer selected by MarkCallow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants