Skip to content

Commit d897994

Browse files
Added GL3bc fallback
1 parent f8e5e67 commit d897994

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

composeApp/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
33
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
44

55
plugins {
6+
67
alias(libs.plugins.kotlinMultiplatform)
78
alias(libs.plugins.composeMultiplatform)
89
alias(libs.plugins.composeCompiler)
910
alias(libs.plugins.composeHotReload)
1011
alias(libs.plugins.kotlinSerialization)
12+
// alias(libs.plugins.composeDesktop)
13+
// alias(libs.plugins.compose.compiler)
1114
}
1215

1316
kotlin {
@@ -81,6 +84,8 @@ kotlin {
8184

8285
implementation("com.github.skydoves:colorpicker-compose:1.1.2")
8386

87+
88+
8489
// val currentOS = DefaultNativePlatform.getCurrentOperatingSystem()
8590
// when {
8691
// currentOS.isWindows -> {

composeApp/src/jvmMain/kotlin/ua/valeriishymchuk/lobmapeditor/ui/App.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import androidx.compose.ui.unit.dp
1717
import androidx.compose.ui.unit.em
1818
import cafe.adriel.voyager.navigator.CurrentScreen
1919
import com.jogamp.opengl.GLCapabilities
20+
import com.jogamp.opengl.GLException
2021
import com.jogamp.opengl.GLProfile
2122
import com.jogamp.opengl.awt.GLCanvas
2223
import com.jogamp.opengl.util.FPSAnimator
@@ -154,7 +155,13 @@ fun JoglCanvas(canvasRefSet: (GLCanvas) -> Unit) {
154155

155156
val canvas = remember {
156157
println("Initializing factory")
157-
val profile = GLProfile.get(GLProfile.GL3)
158+
var profile: GLProfile
159+
try {
160+
profile = GLProfile.get(GLProfile.GL3)
161+
} catch (e: GLException) {
162+
println("GL3 is not available, trying to use GL3bc")
163+
profile = GLProfile.get(GLProfile.GL3bc)
164+
}
158165
val capabilities = GLCapabilities(profile)
159166
// capabilities.isPBuffer = true
160167
capabilities.apply {

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[versions]
22
androidx-lifecycle = "2.9.1"
33
composeHotReload = "1.0.0-beta05"
4+
composeDesktop = "1.7.1"
45
composeMultiplatform = "1.8.2"
56
junit = "4.13.2"
67
kotlin = "2.2.0"

0 commit comments

Comments
 (0)