KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
866 stars 227 forks source link

Add function for app to explicitly make libktx load its GL function pointers. #894

Closed MarkCallow closed 5 months ago

MarkCallow commented 5 months ago

Fixes #708.

MarkCallow commented 5 months ago

@viseztrance, @Raffaello please review.

Raffaello commented 5 months ago

@MarkCallow I have done a quick test, compiling and reinstalling this branch as a RPM on fedora.

patch libktx usage in my own code adding this line before GL_Upload: result = ktxLoadOpenGL((PFNGLGETPROCADDRESS)SDL_GL_GetProcAddress);

and That makes on Fedora passing my tests! 💯 👍

So it looks very good to me!

Problem solved from my side.

Thanks Mark.

viseztrance commented 5 months ago

Thank you! Can also confirm it works. This works nicely (no segfault, no glBindTexture message):

ktxLoadOpenGL(glfwGetProcAddress);

I noticed that if I don't call ktxLoadOpenGL, the code no longer segfaults even though Could not load OpenGL command: glBindTexture! still gets printed like before. (I'll still use ktxLoadOpenGL just to be on the safe side in my code, though).

MarkCallow commented 5 months ago

Thank you for the confirmations @viseztrance and @Raffaello. Glad to hear it doesn't segfault anymore when the new function is not called though I don't understand exactly what is fixed in that regard.