AllenDang / cimgui-go

Auto generated Go wrapper for Dear ImGui via cimgui
MIT License
331 stars 51 forks source link

webgl support? #13

Open gucio321 opened 2 years ago

gucio321 commented 2 years ago

Hi there! IT IS AWESOME!!!!!!! Finally there is some imgui wrapper that is 100% automatic ;-)

What should be done to support WebGl? for now, the build output looks as follows:

[examples (0) ]$ GOOS="js" GOARCH="wasm" go build -o main.wasm main.go 
# github.com/AllenDang/cimgui-go
../texture.go:18:9: undefined: ImTextureID
../texture.go:24:11: undefined: CreateTextureRgba
../texture.go:43:2: undefined: DeleteTexture
../texture.go:46:24: undefined: ImTextureID

let me know if I can help ;-)

gucio321 commented 2 years ago

okey, I forgot to enable CGO, now the error is diffrent:

[examples (2) ]$ CGO_ENABLED=1 GOOS="js" GOARCH="wasm" go build -o main.wasm main.go 
# runtime/cgo
cgo: unknown ptrSize for $GOARCH "wasm"
gucio321 commented 2 years ago

well, two years ago it was this way: https://github.com/golang/go/issues/40543

gucio321 commented 2 years ago

I found this one; maybe it could be used to compile C code into webgl? https://emscripten.org/docs/introducing_emscripten/about_emscripten.html

gucio321 commented 2 years ago

well, so emscripten is able to compile DearImGui. the next step is, to enable this feature in CGO: https://github.com/golang/go/issues/55351

gucio321 commented 2 years ago

ok, so I'm done with researches for today :smile: waiting for any feedback

AllenDang commented 2 years ago

@gucio321 Hah, WebGL is out of my knowledge scope... But, I will do some research!

AllenDang commented 2 years ago

@gucio321 I spent two days but sadly saying I didn't find a way. Sign...

gucio321 commented 2 years ago

@AllenDang takie a look on this one: https://github.com/golang/go/issues/55351

This issue needs to wait for a new go release

SeyRyuu commented 1 year ago

Hey @gucio321 do you have any news or alternatives on this? I'm also interested in using webgl, but I think it is still frozen due to the "cgo and wasm" issue, isn't it?