g3n / engine

Go 3D Game Engine (http://g3n.rocks)
https://discord.gg/NfaeVr8zDg
BSD 2-Clause "Simplified" License
2.8k stars 295 forks source link

Context version issues #206

Closed 68696c6c closed 2 years ago

68696c6c commented 4 years ago

I am using g3n v0.1.0 on Arch linux and get an error when I try to run a simple demo.

I have created a simple demo of my problem here: https://github.com/68696c6c/g3n-demo

Clone the repo and run:

go mod vendor
go run main.go

You should see an error like this:

# github.com/go-gl/glfw/v3.2/glfw
vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw.go:4:10: fatal error: glfw/src/context.c: No such file or directory
    4 | #include "glfw/src/context.c"
      |          ^~~~~~~~~~~~~~~~~~~~

Notice that it is trying to import glfw/v3.2 but g3n is hardcoded to use 3.3 in window/glfw.go line 77 and 78.

    glfw.WindowHint(glfw.ContextVersionMajor, 3)
    glfw.WindowHint(glfw.ContextVersionMinor, 3)

The problem seems to happen because window/glfw.go and window/window.go both import "github.com/go-gl/glfw/v3.2/glfw", not "github.com/go-gl/glfw/v3.3/glfw".

If you edit those files in the vendor directory to import "github.com/go-gl/glfw/v3.3/glfw" instead the demo will run.

The "github.com/go-gl/glfw/v3.2/glfw" package does not include a dummy.go file so the C files it contains are stripped out of the final build. Because of this, I don't think it is possible for G3n to use it, so the hardcoded 3.3 version makes sense. I think the imports just need to be updated to match.

68696c6c commented 4 years ago

I just realized that this seems to be fixed in the master branch so this is just a problem with v0.1.0

Perhaps a new version just needs to be published?

68696c6c commented 4 years ago

I have made a fork of the repo and I think I have a working fix for this if that helps

danaugrs commented 2 years ago

Hey, thanks! This was fixed in v0.2.0. Sorry for the delay in responding.