Closed danila-schelkov closed 1 year ago
Following command produces a normal texture PVRTexToolCLI -noout -i "%%x" -f r8g8b8a8,UBN,sRGB -d "%%x".png
You are using the wrong method. Please try the following code, which I have tested.
ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.length).put(bytes).rewind();
PointerBuffer newTex = PointerBuffer.allocateDirect(1);
int status = KTX.ktxTexture_CreateFromMemory(buffer, KTX.KTX_TEXTURE_CREATE_NO_FLAGS, newTex);
Thanks! That works for me. But what i need to do further to add this texture to the opengl or get texture bytes
See also: ktxTexture_GetData
I've been trying for this, but i don't know how to convert PointerBuffer to actually ktxTexture object
Pointer buffer contains the address of a struct. So you just need to call ktxTexture.create(newTex.get())
Thank you! But I still need to get image pixels as ByteBuffer or byte array. Is it possible to do it?
Oh, I found the best way to load KTX texture to the OpenGL.
Just parse ktx buffer as it described in specs and load each level manually.
Question
PointerBuffer causes the process crash and i can't do anything. My crashlog file: hs_err_pid11848.log
KTX binary file as TXT to avoid github restriction
That's how i'm actually creating the texture from stream:
Some of console output when crashes: