Skip to content

Commit

Permalink
feat: use desktop gl
Browse files Browse the repository at this point in the history
  • Loading branch information
silenium-dev committed Jul 27, 2024
1 parent 803da8d commit 52ef5cd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ dependencies {
}

implementation(libs.bundles.kotlinx.coroutines)
api(libs.bundles.skiko)
api(libs.bundles.skiko) {
version {
strictly(libs.skiko.awt.runtime.linux.x64.get().version!!)
}
}

testImplementation(compose.desktop.currentOs)
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lwjgl-bom = { group = "org.lwjgl", name = "lwjgl-bom", version.ref = "lwjgl" }
lwjgl-core = { group = "org.lwjgl", name = "lwjgl", version.ref = "lwjgl" }
lwjgl-egl = { group = "org.lwjgl", name = "lwjgl-egl", version.ref = "lwjgl" }
lwjgl-glfw = { group = "org.lwjgl", name = "lwjgl-glfw", version.ref = "lwjgl" }
lwjgl-opengles = { group = "org.lwjgl", name = "lwjgl-opengles", version.ref = "lwjgl" }
lwjgl-opengl = { group = "org.lwjgl", name = "lwjgl-opengl", version.ref = "lwjgl" }

skiko-awt = { group = "org.jetbrains.skiko", name = "skiko-awt", version.ref = "skiko" }
skiko-awt-runtime-linux-x64 = { group = "org.jetbrains.skiko", name = "skiko-awt-runtime-linux-x64", version.ref = "skiko" }
Expand All @@ -38,5 +38,5 @@ skiko = [
lwjgl-natives = [
"lwjgl-core",
"lwjgl-glfw",
"lwjgl-opengles",
"lwjgl-opengl",
]
4 changes: 2 additions & 2 deletions src/main/java/dev/silenium/compose/gl/fbo/EGLContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dev.silenium.compose.gl.fbo
import org.lwjgl.egl.EGL
import org.lwjgl.egl.EGL15.*
import org.lwjgl.egl.EGLCapabilities
import org.lwjgl.opengles.GLES
import org.lwjgl.opengl.GL
import org.lwjgl.system.MemoryUtil
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
Expand All @@ -21,7 +21,7 @@ data class EGLContext(
restorePrevious {
makeCurrent()
capabilities = EGL.createDisplayCapabilities(display)
GLES.createCapabilities()
GL.createCapabilities()
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/dev/silenium/compose/gl/fbo/FBOPool.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import dev.silenium.compose.gl.surface.GLDisplayScopeImpl
import dev.silenium.compose.gl.surface.GLDrawScope
import dev.silenium.compose.gl.surface.GLDrawScopeImpl
import org.lwjgl.egl.EGL15.eglGetError
import org.lwjgl.opengles.GLES
import org.lwjgl.opengles.GLES32.*
import org.lwjgl.opengl.GL
import org.lwjgl.opengl.GL30.*
import java.nio.IntBuffer
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
Expand Down Expand Up @@ -45,7 +45,7 @@ class FBOPool(

init {
ensureContext(ContextType.DISPLAY) {
GLES.createCapabilities()
GL.createCapabilities()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlinx.coroutines.*
import kotlinx.coroutines.selects.onTimeout
import kotlinx.coroutines.selects.select
import org.jetbrains.skia.*
import org.lwjgl.opengles.GLES32.GL_RGBA8
import org.lwjgl.opengl.GL30.GL_RGBA8
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicInteger
import kotlin.time.Duration.Companion.milliseconds
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/silenium/compose/gl/util/Snapshot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.silenium.compose.gl.util

import androidx.compose.ui.unit.IntSize
import org.jetbrains.skia.*
import org.lwjgl.opengles.GLES32.*
import org.lwjgl.opengl.GL30.*
import org.lwjgl.system.MemoryUtil
import java.awt.image.BufferedImage
import java.nio.file.Path
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import dev.silenium.compose.gl.surface.GLSurfaceView
import dev.silenium.compose.gl.surface.Stats
import dev.silenium.compose.gl.surface.rememberGLSurfaceState
import kotlinx.coroutines.delay
import org.lwjgl.opengles.GLES30.*
import org.lwjgl.opengl.GL30.*
import kotlin.time.Duration.Companion.milliseconds

@Composable
Expand Down

0 comments on commit 52ef5cd

Please sign in to comment.