korge
korge copied to clipboard
OpenGL and/or Vulkan context
Hello! I know Korge uses its own GL called AG but for a project of mine I would need the raw OpenGL ES 2/3 or Vulkan context. Is it possible to use other parts of Korge and get direct access to said contexts? Is this possible on proper KMP? (Proper=not using GraalVM for a native build) Thanks in advance for all feedback!
Hi.
What are you trying to achieve? It should be possible, but might not work in the future if other implementations are used.
First you need the AG instance (you can get it from the RenderContext instance), then cast it to AGOpengl, then get the gl instance. This is not recommended in any case.
I'm trying to write a Kotlin WebGL1/2 (and later WebGPU) implementation that would be available as native apps.
On Mon, May 13, 2024, 11:17 Carlos Ballesteros Velasco < @.***> wrote:
Hi.
What are you trying to achieve? It should be possible, but might not work in the future if other implementations are used.
First you need the AG instance (you can get it from the RenderContext instance), then cast it to AGOpengl, then get the gl instance. This is not recommended in any case.
— Reply to this email directly, view it on GitHub https://github.com/korlibs/korge/issues/2229#issuecomment-2107061686, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAPQZUYVFYG7JJGYAVEKFTZCCAJBAVCNFSM6AAAAABHSZNQGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBXGA3DCNRYGY . You are receiving this because you authored the thread.Message ID: @.***>
@jdw K/N target was removed a few versions ago. The reason is that the mingwX64 target was slow compiling and running, one order of magnitude than the JVM target due to ThreadLocal issues. I tried to insist on fixing that for quite a long time, but being able to publish UWP was a priority over having one order of magnitude of performance loss; I used to include patches on the K/N library itself but was not reasonable. That was not an issues in the case of Macos and Linux; but for Korge / Videogames most people uses Windows. Maintaining those targets was time-consuming, coding and keeping CI spending time on it, specially when using it was subpar, so I dropped it. And having different behaviour: K/N on Linux/Mac over Windows JVM, was not a good thing.
Since one can use GraalVM and embed a JVM too, I decided to use an embedded JVM on desktop. Eventually my idea is to transpile the WASM target (compilation times are excellent) into C++ and use SDL and OpenGL/Vulkan/WebGPU to target everything else not covered in JVM/JS/Android/iOS and generate native dependency-less executables. Not in the short term, though.
The idea is consumers to use AG (evolving it if necessary, if something is lacky), and provide implementations of AG using the current OpenGL/WebGL and eventually WebGPU/Metal/Vulkan.
@ygdrasil-io is working on a WebGPU implementation.
@jdw I hope to release a first version on AG based on WebGPU before the end of the year. But, if you use Korge, it is better to use the abstraction layer provided rather than the low lever API, else go directly to WebGPU instead of using Korge.
If you are interessted, the proof of concept is here https://github.com/wgpu4k/wgpu4k