Skip to content

Commit

Permalink
fix: allow requesting of opengl functions via GLContext
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxnii committed Oct 18, 2024
1 parent 6183357 commit 3a168b8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/lwjgl/src/main/kotlin/org/lwjgl/opengl/GLContext.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package org.lwjgl.opengl

import kotlin.concurrent.getOrSet

object GLContext {
private val capabilities = mutableMapOf<Thread, ContextCapabilities>()
private val capabilities = ThreadLocal<ContextCapabilities>()

@JvmStatic
fun getCapabilities(): ContextCapabilities {
return capabilities.computeIfAbsent(Thread.currentThread()) { thread ->
return capabilities.getOrSet {
ContextCapabilities()
}
}

@JvmStatic
fun getFunctionAddress(function: String): Long =
GL.getFunctionProvider()?.getFunctionAddress(function) ?: 0
}

0 comments on commit 3a168b8

Please sign in to comment.