generated from soypat/go-module-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
go version
go version go1.24.5 darwin/arm64
GODEBUG=cgocheck=0 go run github.com/soypat/gsdf/examples/bolt@latest -gpu
using GPU ᵍᵒᵗᵗᵃ ᵍᵒ ᶠᵃˢᵗ
2025/07/17 23:17:52 VersionUnavailable: NSGL: The targeted version of macOS only supports forward-compatible core profile contexts for OpenGL 3.2 and above
exit status 1
solutions
Via Claude. just writing here so I can swing back onto this...
Solution 1: Update GLFW Context Hints
You need to explicitly set the OpenGL context to be forward-compatible when initializing GLFW. In your Go code, before creating the window, add these hints:
gopackage main
import (
"github.com/go-gl/glfw/v3.3/glfw"
"github.com/go-gl/gl/v4.1-core/gl"
)
func main() {
// Initialize GLFW
if err := glfw.Init(); err != nil {
panic(err)
}
defer glfw.Terminate()
// Set OpenGL context hints for macOS compatibility
glfw.WindowHint(glfw.ContextVersionMajor, 3)
glfw.WindowHint(glfw.ContextVersionMinor, 2)
glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)
glfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True)
// Create window
window, err := glfw.CreateWindow(800, 600, "GSDF Viewer", nil, nil)
if err != nil {
panic(err)
}
window.MakeContextCurrent()
// Initialize OpenGL
if err := gl.Init(); err != nil {
panic(err)
}
// Your rendering code here...
}
Solution 2: Use the Correct OpenGL Package
Make sure you're using the core profile OpenGL package. Update your imports:
go// Instead of:
// import "github.com/go-gl/gl/v2.1/gl"
// Use:
import "github.com/go-gl/gl/v4.1-core/gl"
Solution 3: Update Your go.mod
Try updating to use the core profile version:
bashgo get github.com/go-gl/gl/v4.1-core/gl
Then update your go.mod:
gomodule github.com/soypat/gsdf
go 1.23.0
toolchain go1.24.2
require (
github.com/chewxy/math32 v1.11.1
github.com/go-gl/gl/v4.1-core/gl v0.0.0-20231021071112-07e5d0ea2e71
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728
// ... rest of your dependencies
)
LucDrenth
Metadata
Metadata
Assignees
Labels
No labels