-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GL upload function to Java interface (#959)
(This builds upon #957, so that should be merged first) This adds bindings for the `ktxTexture_GLUpload` function to the Java interface. There certainly are a few degrees of freedom about how _exactly_ that should be offered. And there is a trade-off between "trying to closely resemble the existing API" and "trying to create a nice API for Java". The main point here being that the function receives three _pointers_ (to `int` values, essentially). And pointers don't exist in Java. A common (although not pretty) way is to emulate these with single-element arrays. So the call currently looks like this: ``` int texture[] = { 0 }; int target[] = { 0 }; int glError[] = { 0 }; int result = ktxTexture.glUpload(texture, target, glError); ``` This will fill the given arrays with the values that are returned from the native layer, accordingly. Proper testing may be difficult. The basic call conditions are checked in a unit test. But beyond that, really _using_ the function will require an OpenGL context to be current, so that 1. requires an OpenGL binding for the test, and 2. can hardly happen during the standard test runs. --- I tried it out in a _very_ basic experiment. This experiment currently used https://www.lwjgl.org/ , but I'll probably also try it with https://jogamp.org/ . Given that LWJGL is the library behind https://libgdx.com/ and https://jmonkeyengine.org/ , that's likely to be a primary goal. The result of that experiment is shown here... ![Khronos KTX in Java](https://github.com/user-attachments/assets/7c86d565-5fdf-4f31-a20c-f6616c2c99ed) ... and I frankly couldn't care less that it's upside down. It works 🙃
- Loading branch information
Showing
3 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters