Coder Social home page Coder Social logo

g3nd's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

g3nd's Issues

"-interval 0" no longer exists?

The README.md presently mentions using g3nd with -interval 0 as a way to measure the maximum FPS:

To check the maximum FPS rate (frames per second) of your system for any demo, run G3ND with the option -interval 0.

g3nd doesn't recognise the option though, instead displaying and error and standard known flags list:

$ g3nd -interval 0 geometry.box
flag provided but not defined: -interval
G3N Demo v0.5
usage: g3nd [options] [<test>] 
  -cpuprofile string
        Activate cpu profiling writing profile to the specified file
  -exectrace string
        Activate execution tracer writing data to the specified file
  -fullscreen
        Starts application with full screen
  -hidefps
        Do now show calculated FPS in the GUI
  -logs string
        Set log levels for packages. Ex: gui:debug,gls:info
  -noglerrors
        Do not check OpenGL errors at each call (may increase FPS)
  -nogui
        Do not show the GUI, only the specified demo
  -renderstats
        Shows gui renderer statistics in the console
  -stats
        Shows statistics control panel in the GUI
  -swapinterval int
        Sets the swap buffers interval to this value (default -1)
  -targetfps uint
        Sets the frame rate in frames per second (default 60)
  -updatefps uint
        Time interval in milliseconds to update the FPS in the GUI (default 1000)

Guessing the option has been renamed or something. ๐Ÿ˜‰ The README.md should probably be updated to match.

Beginners Issues

Hi Guys,

Sorry for some of the newbieness here but I am struggling to find any documentation on how to do the simplest things.

For instance creation of a blank window, from what I can see of the code the the app struct can initialise a window for me but this seems to come with a load of stuff that I don't need, I have also looked at the recommended game and I can see that they don't use an app, and from both I can see they use the following pattern to start the window initialisation.

`
// Window event handling must run on the main OS thread
runtime.LockOSThread()

// Get the window manager
Win , err := window.Manager("glfw")
if err != nil {
	panic(err)
}

`

after which they use this to create a window, the issue is that is I try to use this pattern I get

image: unknown format

and cant seem to get to the window setup.

any newb help would be great, a doc would be even better.

thanks

John

go get fails ??

just trying this out

x-MacBook-Pro:3gn apple$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/apple/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/apple/workspace/go"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/go-build769837385=/tmp/go-build -gno-record-gcc-switches -fno-common"

go get -u -v github.com/g3n/g3nd
github.com/g3n/g3nd (download)
github.com/g3n/engine (download)
github.com/go-gl/glfw (download)
github.com/golang/freetype (download)
Fetching https://golang.org/x/image/math/fixed?go-get=1
Parsing meta tags from https://golang.org/x/image/math/fixed?go-get=1 (status code 200)
get "golang.org/x/image/math/fixed": found meta tag get.metaImport{Prefix:"golang.org/x/image", VCS:"git", RepoRoot:"https://go.googlesource.com/image"} at https://golang.org/x/image/math/fixed?go-get=1
get "golang.org/x/image/math/fixed": verifying non-authoritative meta tag
Fetching https://golang.org/x/image?go-get=1
Parsing meta tags from https://golang.org/x/image?go-get=1 (status code 200)
golang.org/x/image (download)
Fetching https://golang.org/x/image/font?go-get=1
Parsing meta tags from https://golang.org/x/image/font?go-get=1 (status code 200)
get "golang.org/x/image/font": found meta tag get.metaImport{Prefix:"golang.org/x/image", VCS:"git", RepoRoot:"https://go.googlesource.com/image"} at https://golang.org/x/image/font?go-get=1
get "golang.org/x/image/font": verifying non-authoritative meta tag
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
github.com/kardianos/osext (download)
github.com/g3n/engine/audio/vorbis
github.com/g3n/engine/audio/al
github.com/g3n/engine/audio/ov

github.com/g3n/engine/audio/vorbis

../../../../../../github.com/g3n/engine/audio/vorbis/vorbis.go:15:11: fatal error: 'codec.h' file not found
#include "codec.h"
^~~~~~~~~
1 error generated.

github.com/g3n/engine/audio/ov

../../../../../../github.com/g3n/engine/audio/ov/vorbisfile.go:16:11: fatal error: 'vorbisfile.h' file not found
#include "vorbisfile.h"
^~~~~~~~~~~~~~
1 error generated.

github.com/g3n/engine/audio/al

../../../../../../github.com/g3n/engine/audio/al/al.go:19:10: fatal error: 'al.h' file not found
#include "al.h"
^~~~~~
1 error generated.
make: *** [dep] Error 2

Run on mobiles using flutter

I think I can get this going..

https://github.com/mogol/opengl_texture_widget_example

The flutter Texture object is how it's done
I run golang code inside flutter now so there is a good chance here it will work.

If anyone else is interested let me know

Best way will be to take the g3nd demo and remove the side nav and let flutter do that bit. Then we can run the exact same demos that it runs on desktop.

Anyone holler if your interested in this as I might need help from the core Devs

Lacking vector movement demos

There was a question in help topic on g3n Discord a few weeks ago where someone asked after examples of simple movement of characters. I seconded the question because I also had no idea how.

There were no answers. So I did research on game dev math, played around in g3n and the result is a small g3n movement demo (g3nmovedemo).

It has a simple translation/rotation mode, a "flying/steering" mode, smooth buffered motion, a smooth quat slerp "LookAt()", and demonstrates backstabbing.

If you like I can prepare a simple set of demos to be included in g3nd.

If this interests you, let me know.

GUI Builder demo does not appear to be working

The layout is displayed over the top of selection. I cannot seem to click on the other yaml files.

Tested on both Mac and Ubuntu.

Maybe I should have asked about the expected behavior in the discord first, but it seems like you should be able to click one of the yaml files to load a different layout.

306054769-969769a7-525c-4322-ae47-2b2d531b3aec 306054562-83dbe119-8a56-4cfd-ac9a-9b837d69fca0

Crash after idle on Windows

I had the demo running for a while, when I either moused over it, or clicked on it it crashed.

Here is the log/traceback...
$ ./g3nd
07:12:05.107360:I:G3ND:OpenGL version: 3.3.0
07:12:05.115358:I:G3ND:G3N Demo v0.5 starting
07:12:05.116359:I:G3ND:Using data directory:C:\Users\steve\go\src\github.com\g3n\g3nd\data
07:12:05.342506:I:G3ND:OpenAL Community version: 1.1 ALSOFT 1.18.2
07:12:05.342704:I:G3ND:Xiph.Org libVorbis 1.3.5
fatal error: startm: m has p

runtime stack:
runtime.throw(0x81924f, 0xf)
C:/Go/src/runtime/panic.go:616 +0x88
runtime.startm(0x0, 0x406fd01)
C:/Go/src/runtime/proc.go:2009 +0x1ea
runtime.wakep()
C:/Go/src/runtime/proc.go:2083 +0x4f
runtime.resetspinning()
C:/Go/src/runtime/proc.go:2454 +0x7f
runtime.schedule()
C:/Go/src/runtime/proc.go:2548 +0x133
runtime.park_m(0xc04202c600)
C:/Go/src/runtime/proc.go:2604 +0xcb
runtime.mcall(0x0)
C:/Go/src/runtime/asm_amd64.s:351 +0x5e

goroutine 1 [runnable, locked to thread]:
github.com/go-gl/glfw/v3.2/glfw._Cfunc_glfwPollEvents()
_cgo_gotypes.go:1150 +0x48
github.com/go-gl/glfw/v3.2/glfw.PollEvents()
C:/Users/steve/go/src/github.com/go-gl/glfw/v3.2/glfw/window.go:771 +0x27
github.com/g3n/engine/window.(*glfwManager).PollEvents(0xc0420ac3c0)
C:/Users/steve/go/src/github.com/g3n/engine/window/glfw.go:127 +0x27
github.com/g3n/engine/util/application.(*Application).Run(0xc04205c640, 0x0, 0x0)
C:/Users/steve/go/src/github.com/g3n/engine/util/application/application.go:477 +0x2ec
main.main()
C:/Users/steve/go/src/github.com/g3n/g3nd/main.go:28 +0x54
AL lib: (EE) alc_cleanup: 1 device not closed

Should g3nd auto-detect where it's data directory lives?

Compiled g3nd following the instructions, then attempted to run it (from my home dir). Failure, as it doesn't seem to know how to look for it's data directory:

$ g3nd 
16:00:55.296763:I:G3ND:G3N Demo v0.5 starting
16:00:55.296894:F:G3ND:Data directory NOT FOUND
panic: LOG FATAL

goroutine 1 [running, locked to thread]:
github.com/g3n/engine/util/logger.(*Logger).Log(0xc4200bed90, 0x4, 0x7ccbe7, 0x18, 0x0, 0x0, 0x0)
        /home/jc/go/src/github.com/g3n/engine/util/logger/logger.go:253 +0x103b
github.com/g3n/engine/util/logger.(*Logger).Fatal(0xc4200bed90, 0x7ccbe7, 0x18, 0x0, 0x0, 0x0)
        /home/jc/go/src/github.com/g3n/engine/util/logger/logger.go:194 +0x66
github.com/g3n/g3nd/g3nd.(*App).checkDirData(0xc4200d4800, 0x7c373f, 0x4, 0xc4200f1eb8, 0x3)
        /home/jc/go/src/github.com/g3n/g3nd/g3nd/g3nd.go:553 +0x236
github.com/g3n/g3nd/g3nd.Create(0xc420084870, 0xc4200f1f70)
        /home/jc/go/src/github.com/g3n/g3nd/g3nd/g3nd.go:114 +0x21e
main.main()
        /home/jc/go/src/github.com/g3n/g3nd/main.go:23 +0x2d

When launching it from the source directory which go get places it in, things work fine:

$ pwd
/home/jc/go/src/github.com/g3n/g3nd
$ g3nd
16:04:07.637331:I:G3ND:G3N Demo v0.5 starting
16:04:07.637487:I:G3ND:Using data directory:/home/jc/go/src/github.com/g3n/g3nd/data
16:04:07.637516:I:G3ND:OpenGL version: 4.3 (Core Profile) Mesa 17.0.1
16:04:07.681134:I:G3ND:OpenAL Community version: 1.1 ALSOFT 1.16.0
16:04:07.681520:I:G3ND:Xiph.Org libVorbis 1.3.3
...

Is this expected?

Mobiles

Is mobile envisaged ?

If it run access the opengl engine we are good. In terms of integration with the GUI I am thinking of using flutter. It has an asynchronous resource loading pipeline and can accept opengl outputs.

Flutter and golang run on all desktops and mobiles with zero code changes today. you just need a simple binding wrapper written in dart to access golang.
You just do the normal gomobile bind for mobile

shadow example

would be useful to see an example of the implementation of shadows/shadow map. thx.

Demo doesn't work

I just followed the instructions to download the project and install it, and it failed thusly:

$ git clone https://github.com/g3n/g3nd
Cloning into 'g3nd'...
remote: Enumerating objects: 2438, done.
remote: Counting objects: 100% (123/123), done.
remote: Compressing objects: 100% (105/105), done.
remote: Total 2438 (delta 35), reused 46 (delta 14), pack-reused 2315
Receiving objects: 100% (2438/2438), 50.86 MiB | 27.31 MiB/s, done.
Resolving deltas: 100% (1482/1482), done.
$ cd g3nd
$ go install
go: downloading github.com/g3n/engine v0.1.1-0.20210609173700-de78e3c4204a
go: downloading github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
go: downloading github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb
go: downloading github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
go: downloading golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9
# github.com/g3n/engine/audio/vorbis
../../../tools/gostuff/pkg/mod/github.com/g3n/[email protected]/audio/vorbis/vorbis.go:17:11: fatal error: codec.h: No such file or directory
   17 | // #include "codec.h"
      |           ^~~~~~~~~
compilation terminated.
# github.com/g3n/engine/audio/ov
../../../tools/gostuff/pkg/mod/github.com/g3n/[email protected]/audio/ov/vorbisfile.go:18:11: fatal error: vorbisfile.h: No such file or directory
   18 | // #include "vorbisfile.h"
      |           ^~~~~~~~~~~~~~
compilation terminated.
# github.com/g3n/engine/audio/al
../../../tools/gostuff/pkg/mod/github.com/g3n/[email protected]/audio/al/al.go:18:11: fatal error: al.h: No such file or directory
   18 | // #include "al.h"
      |           ^~~~~~
compilation terminated.
# github.com/go-gl/glfw/v3.3/glfw
In file included from ./glfw/src/internal.h:188,
                 from ./glfw/src/context.c:30,
                 from ../../../tools/gostuff/pkg/mod/github.com/go-gl/glfw/v3.3/[email protected]/c_glfw.go:4:
./glfw/src/x11_platform.h:36:10: fatal error: X11/Xcursor/Xcursor.h: No such file or directory
   36 | #include <X11/Xcursor/Xcursor.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
`

Bug in gui Table example

The right-click menu becomes invisible after rows in the table have been modified.

When you load the example, right click on the first two default entries, the right click menu works as supposed. However, if you add some rows to the table, the right click menu will be rendered underneath the new rows. You can see it by right clicking one of the first two rows again.

Weird behaviour with raycasting under ortographic camera projection

On the other->raycast demo, which works fine by default, if you change the camera projection to Orthographic (Controls button, uncheck "Perspective camera"), you can no longer select meshes with your mouse cursor.
Instead it seems to only hit meshes that appear on the very center of the demo's viewport, regardless of the mouse's relative position over it (you can try panning the camera to any side and start clicking to see it hits whatever it is on the center).
Not sure if that is the intended behaviour or if Raycasting is not supported under orthographic projection.

Panic on gui/splitter

While sequentially exploring the demo, I got the following exception when I was testing the splitter demo.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x418 pc=0x5e0572]

goroutine 1 [running, locked to thread]:
github.com/g3n/engine/gui.(*Root).SetCursorVResize(0x0)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/gui/root.go:163 +0x22
github.com/g3n/engine/gui.(*Splitter).onCursor(0xc420a3f000, 0x82a032, 0x11, 0x76c680, 0xc4205f5118)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/gui/splitter.go:148 +0x15b
github.com/g3n/engine/gui.(*Splitter).(github.com/g3n/engine/gui.onCursor)-fm(0x82a032, 0x11, 0x76c680, 0xc4205f5118)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/gui/splitter.go:84 +0x52
github.com/g3n/engine/core.(*Dispatcher).Dispatch(0xc420a3fbd8, 0x82a032, 0x11, 0x76c680, 0xc4205f5118, 0xc420000100)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/core/dispatcher.go:104 +0xbf
github.com/g3n/engine/gui.(*Root).sendPanels(0xc420132000, 0x43c5800043570000, 0x827aef, 0xc, 0x76c680, 0xc4205f5118)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/gui/root.go:290 +0x40f
github.com/g3n/engine/gui.(*Root).onCursor(0xc420132000, 0x827aef, 0xc, 0x76c680, 0xc4205f5118)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/gui/root.go:209 +0x79
github.com/g3n/engine/gui.(*Root).(github.com/g3n/engine/gui.onCursor)-fm(0x827aef, 0xc, 0x76c680, 0xc4205f5118)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/gui/root.go:57 +0x52
github.com/g3n/engine/core.(*Dispatcher).Dispatch(0xc4205f5040, 0x827aef, 0xc, 0x76c680, 0xc4205f5118, 0x22c6c10)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/core/dispatcher.go:104 +0xbf
github.com/g3n/engine/window.newGLFW.func6(0xc4200da280, 0x406ae00000000000, 0x4078b00000000000)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/window/glfw.go:142 +0xa9
github.com/go-gl/glfw/v3.2/glfw.goCursorPosCB(0x22c6c10, 0x406ae00000000000, 0x4078b00000000000)
	/home/herbert/Workspace/Go/src/github.com/go-gl/glfw/v3.2/glfw/input.go:267 +0x61
github.com/go-gl/glfw/v3.2/glfw._cgoexpwrap_1abbaa5bda2c_goCursorPosCB(0x22c6c10, 0x406ae00000000000, 0x4078b00000000000)
	github.com/go-gl/glfw/v3.2/glfw/_obj/_cgo_gotypes.go:2087 +0x43
github.com/go-gl/glfw/v3.2/glfw._Cfunc_glfwPollEvents()
	github.com/go-gl/glfw/v3.2/glfw/_obj/_cgo_gotypes.go:1188 +0x41
github.com/go-gl/glfw/v3.2/glfw.PollEvents()
	/home/herbert/Workspace/Go/src/github.com/go-gl/glfw/v3.2/glfw/window.go:752 +0x20
github.com/g3n/engine/window.(*GLFW).PollEvents(0xc4205f5040)
	/home/herbert/Workspace/Go/src/github.com/g3n/engine/window/glfw.go:237 +0x20
main.main()
	/home/herbert/Workspace/Go/src/github.com/g3n/g3nd/main.go:252 +0xf48

README needs a note regarding g3n engine version

Hi,

First let me say this demo has completely blown me away, sooooo cool. (Kubuntu 20.04). Am I out of the loop? Because it seems to me there should be some serious buzz about the capabilities of g3n.

tldr; people need to know that they must install g3n v0.1.0 also. I had installed g3n v0.2.0 only at first and g3nd would not build/install.

I did not, at this time want to clone g3n or g3nd, so I used go get instead (I'm on go 1.18) for both.

Building g3nd produced these messages:
...
github.com/g3n/g3nd imports
github.com/g3n/g3nd/app imports
github.com/g3n/engine/camera/control: cannot find module providing package github.com/g3n/engine/camera/control
github.com/g3n/g3nd imports
github.com/g3n/g3nd/app imports
github.com/g3n/engine/util/application: cannot find module providing package github.com/g3n/engine/util/application

my solution was simply to:
go get github.com/g3n/[email protected]

then all is well.

Runtime panic on OS X complaining about OpenGL version

$ hellog3n
panic: VersionUnavailable: NSGL: The targeted version of OS X only supports forward-compatible contexts for OpenGL 3.2 and above

OS X supports opengl 4.1 at least. Could you please help me with fixing this problem?
I'll also provide a PR fixing build with OpenAL and Vorbis a bit later, I'm still fixing it.

If you are willing to test the engine on OS X, I may help you.

opengl (Runtime?) error on mac platform

it errors when click any of the function

04:11:12.200080:I:G3ND:G3N Demo v0.2 starting
04:11:12.200182:I:G3ND:Using data directory:/Users/mudu/gopath/src/github.com/g3n/g3nd/data
04:11:12.409702:I:G3ND:OpenGL version: 4.1 INTEL-10.25.17
04:11:12.456508:I:G3ND:Apple Computer Inc. version: 1.1
04:11:12.457158:W:G3ND:Error loading libvorbisfile shared library/dll

GLAPI Error: 1281 calling: glLineWidth

Material demos crash

The recently pushed demos crash on macOS.
Demos crashing: boxmulti2, physical_helmet.

08:49:14.510738:I:G3ND:OpenGL version: 4.1 ATI-1.66.31
08:49:14.511004:I:G3ND:G3N Demo v0.5 starting
08:49:14.511067:I:G3ND:Using data directory:/Users/dobegor/go/src/github.com/g3n/g3nd/data
08:49:14.562467:I:G3ND:OpenAL Community version: 1.1 ALSOFT 1.18.2
08:49:14.562766:I:G3ND:Xiph.Org libVorbis 1.3.6
panic: Error compiling Fragment Shader: ERROR: 0:185: Invalid call of undeclared identifier 'texture2D'
ERROR: 0:186: Use of undeclared identifier 'n'
ERROR: 0:186: Use of undeclared identifier 'n'
ERROR: 0:192: Use of undeclared identifier 'n'
ERROR: 0:306: Invalid call of undeclared identifier 'texture2D'
ERROR: 0:307: Use of undeclared identifier 'mrSample'
ERROR: 0:308: Use of undeclared identifier 'mrSample'
ERROR: 0:319: Invalid call of undeclared identifier 'texture2D'
ERROR: 0:325: Use of undeclared identifier 'baseColor'
ERROR: 0:326: Use of undeclared identifier 'diffuseColor'
ERROR: 0:328: Use of undeclared identifier 'baseColor'
ERROR: 0:331: Use of undeclared identifier 'specularColor'
ERROR: 0:331: Use of undeclared identifier 'specularColor'
ERROR: 0:331: Use of undeclared identifier 'specularColor'
ERROR: 0:335: Use of undeclared identifier 'reflectance'
ERROR: 0:336: Use of undeclared identifier 'specularColor'
ERROR: 0:337: Use of undeclared identifier 'reflectance90'
ERROR: 0:342: Use of undeclared identifier 'specularEnvironmentR0'
ERROR: 0:343: Use of undeclared identifier 'specularEnvironmentR90'
ERROR: 0:345: Use of undeclared identifier 'diffuseColor'
ERROR: 0:346: Use of undeclared identifier 'specularColor'
ERROR: 0:355: Use of undeclared identifier 'pbrInputs'
ERROR: 0:366: Use of undeclared identifier 'pbrInputs'
ERROR: 0:384: Use of undeclared identifier 'pbrInputs'
ERROR: 0:422: Invalid call of undeclared identifier 'texture2D'
ERROR: 0:423: Use of undeclared identifier 'ao'
ERROR: 0:427: Invalid call of undeclared identifier 'texture2D'
ERROR: 0:431: Use of undeclared identifier 'emissive'
ERROR: 0:464: Use of undeclared identifier 'baseColor'
001:#version 330 core
002:#define AMB_LIGHTS 1
003:#define POINT_LIGHTS 2
004:#define SPOT_LIGHTS 0
005:#define HAS_OCCLUSIONMAP
006:#define HAS_METALROUGHNESSMAP
007:#define DIR_LIGHTS 3
008:#define MAT_TEXTURES 5
009:#define HAS_NORMALMAP
010:#define HAS_EMISSIVEMAP
011:#define HAS_BASECOLORMAP
012://
013:// Physically Based Shading of a microfacet surface material - Fragment Shader
014:// Modified from reference implementation at https://github.com/KhronosGroup/glTF-WebGL-PBR
015://
016:// References:
017:// [1] Real Shading in Unreal Engine 4
018://     http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
019:// [2] Physically Based Shading at Disney
020://     http://blog.selfshadow.com/publications/s2012-shading-course/burley/s2012_pbs_disney_brdf_notes_v3.pdf
021:// [3] README.md - Environment Maps
022://     https://github.com/KhronosGroup/glTF-WebGL-PBR/#environment-maps
023:// [4] "An Inexpensive BRDF Model for Physically based Rendering" by Christophe Schlick
024://     https://www.cs.virginia.edu/~jdl/bib/appearance/analytic%20models/schlick94b.pdf
025:
026://#extension GL_EXT_shader_texture_lod: enable
027://#extension GL_OES_standard_derivatives : enable
028:
029:precision highp float;
030:
031://uniform vec3 u_LightDirection;
032://uniform vec3 u_LightColor;
033:
034://#ifdef USE_IBL
035://uniform samplerCube u_DiffuseEnvSampler;
036://uniform samplerCube u_SpecularEnvSampler;
037://uniform sampler2D u_brdfLUT;
038://#endif
039:
040:#ifdef HAS_BASECOLORMAP
041:uniform sampler2D uBaseColorSampler;
042:#endif
043:#ifdef HAS_METALROUGHNESSMAP
044:uniform sampler2D uMetallicRoughnessSampler;
045:#endif
046:#ifdef HAS_NORMALMAP
047:uniform sampler2D uNormalSampler;
048://uniform float uNormalScale;
049:#endif
050:#ifdef HAS_EMISSIVEMAP
051:uniform sampler2D uEmissiveSampler;
052:#endif
053:#ifdef HAS_OCCLUSIONMAP
054:uniform sampler2D uOcclusionSampler;
055:uniform float uOcclusionStrength;
056:#endif
057:
058:// Material parameters uniform array
059:uniform vec4 Material[3];
060:// Macros to access elements inside the Material array
061:#define uBaseColor		    Material[0]
062:#define uEmissiveColor      Material[1]
063:#define uMetallicFactor     Material[2].x
064:#define uRoughnessFactor    Material[2].y
065:
066://
067:// Lights uniforms
068://
069:
070:// Ambient lights uniforms
071:#if AMB_LIGHTS>0
072:    uniform vec3 AmbientLightColor[AMB_LIGHTS];
073:#endif
074:
075:// Directional lights uniform array. Each directional light uses 2 elements
076:#if DIR_LIGHTS>0
077:    uniform vec3 DirLight[2*DIR_LIGHTS];
078:    // Macros to access elements inside the DirectionalLight uniform array
079:    #define DirLightColor(a)		DirLight[2*a]
080:    #define DirLightPosition(a)		DirLight[2*a+1]
081:#endif
082:
083:// Point lights uniform array. Each point light uses 3 elements
084:#if POINT_LIGHTS>0
085:    uniform vec3 PointLight[3*POINT_LIGHTS];
086:    // Macros to access elements inside the PointLight uniform array
087:    #define PointLightColor(a)			PointLight[3*a]
088:    #define PointLightPosition(a)		PointLight[3*a+1]
089:    #define PointLightLinearDecay(a)	PointLight[3*a+2].x
090:    #define PointLightQuadraticDecay(a)	PointLight[3*a+2].y
091:#endif
092:
093:#if SPOT_LIGHTS>0
094:    // Spot lights uniforms. Each spot light uses 5 elements
095:    uniform vec3  SpotLight[5*SPOT_LIGHTS];
096:
097:    // Macros to access elements inside the PointLight uniform array
098:    #define SpotLightColor(a)			SpotLight[5*a]
099:    #define SpotLightPosition(a)		SpotLight[5*a+1]
100:    #define SpotLightDirection(a)		SpotLight[5*a+2]
101:    #define SpotLightAngularDecay(a)	SpotLight[5*a+3].x
102:    #define SpotLightCutoffAngle(a)		SpotLight[5*a+3].y
103:    #define SpotLightLinearDecay(a)		SpotLight[5*a+3].z
104:    #define SpotLightQuadraticDecay(a)	SpotLight[5*a+4].x
105:#endif
106:
107:
108:
109:// Inputs from vertex shader
110:in vec3 Position;       // Vertex position in camera coordinates.
111:in vec3 Normal;         // Vertex normal in camera coordinates.
112:in vec3 CamDir;         // Direction from vertex to camera
113:in vec2 FragTexcoord;
114:
115:// Final fragment color
116:out vec4 FragColor;
117:
118:// Encapsulate the various inputs used by the various functions in the shading equation
119:// We store values in this struct to simplify the integration of alternative implementations
120:// of the shading terms, outlined in the Readme.MD Appendix.
121:struct PBRLightInfo
122:{
123:    float NdotL;                  // cos angle between normal and light direction
124:    float NdotV;                  // cos angle between normal and view direction
125:    float NdotH;                  // cos angle between normal and half vector
126:    float LdotH;                  // cos angle between light direction and half vector
127:    float VdotH;                  // cos angle between view direction and half vector
128:};
129:
130:struct PBRInfo
131:{
132:    float perceptualRoughness;    // roughness value, as authored by the model creator (input to shader)
133:    float metalness;              // metallic value at the surface
134:    vec3 reflectance0;            // full reflectance color (normal incidence angle)
135:    vec3 reflectance90;           // reflectance color at grazing angle
136:    float alphaRoughness;         // roughness mapped to a more linear change in the roughness (proposed by [2])
137:    vec3 diffuseColor;            // color contribution from diffuse lighting
138:    vec3 specularColor;           // color contribution from specular lighting
139:};
140:
141:const float M_PI = 3.141592653589793;
142:const float c_MinRoughness = 0.04;
143:
144:vec4 SRGBtoLINEAR(vec4 srgbIn) {
145://#ifdef MANUAL_SRGB
146://    #ifdef SRGB_FAST_APPROXIMATION
147://        vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
148://    #else //SRGB_FAST_APPROXIMATION
149:        vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
150:        vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
151://    #endif //SRGB_FAST_APPROXIMATION
152:        return vec4(linOut,srgbIn.w);
153://#else //MANUAL_SRGB
154://    return srgbIn;
155://#endif //MANUAL_SRGB
156:}
157:
158:// Find the normal for this fragment, pulling either from a predefined normal map
159:// or from the interpolated mesh normal and tangent attributes.
160:vec3 getNormal()
161:{
162:    // Retrieve the tangent space matrix
163://#ifndef HAS_TANGENTS
164:    vec3 pos_dx = dFdx(Position);
165:    vec3 pos_dy = dFdy(Position);
166:    vec3 tex_dx = dFdx(vec3(FragTexcoord, 0.0));
167:    vec3 tex_dy = dFdy(vec3(FragTexcoord, 0.0));
168:    vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
169:
170://#ifdef HAS_NORMALS
171:    vec3 ng = normalize(Normal);
172://#else
173://    vec3 ng = cross(pos_dx, pos_dy);
174://#endif
175:
176:    t = normalize(t - ng * dot(ng, t));
177:    vec3 b = normalize(cross(ng, t));
178:    mat3 tbn = mat3(t, b, ng);
179://#else // HAS_TANGENTS
180://    mat3 tbn = v_TBN;
181://#endif
182:
183:#ifdef HAS_NORMALMAP
184:    float uNormalScale = 1.0;
185:    vec3 n = texture2D(uNormalSampler, FragTexcoord).rgb;
186:    n = normalize(tbn * ((2.0 * n - 1.0) * vec3(uNormalScale, uNormalScale, 1.0)));
187:#else
188:    // The tbn matrix is linearly interpolated, so we need to re-normalize
189:    vec3 n = normalize(tbn[2].xyz);
190:#endif
191:
192:    return n;
193:}
194:
195:// Calculation of the lighting contribution from an optional Image Based Light source.
196:// Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
197:// See our README.md on Environment Maps [3] for additional discussion.
198:vec3 getIBLContribution(PBRInfo pbrInputs, PBRLightInfo pbrLight, vec3 n, vec3 reflection)
199:{
200:    float mipCount = 9.0; // resolution of 512x512
201:    float lod = (pbrInputs.perceptualRoughness * mipCount);
202:    // retrieve a scale and bias to F0. See [1], Figure 3
203:    vec3 brdf = vec3(0.5,0.5,0.5);//SRGBtoLINEAR(texture2D(u_brdfLUT, vec2(pbrLight.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
204:    vec3 diffuseLight = vec3(0.5,0.5,0.5);//SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
205:
206://#ifdef USE_TEX_LOD
207://    vec3 specularLight = SRGBtoLINEAR(textureCubeLodEXT(u_SpecularEnvSampler, reflection, lod)).rgb;
208://#else
209:    vec3 specularLight = vec3(0.5,0.5,0.5);//SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;
210://#endif
211:
212:    vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
213:    vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
214:
215:    // For presentation, this allows us to disable IBL terms
216://    diffuse *= u_ScaleIBLAmbient.x;
217://    specular *= u_ScaleIBLAmbient.y;
218:
219:    return diffuse + specular;
220:}
221:
222:// Basic Lambertian diffuse
223:// Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
224:// See also [1], Equation 1
225:vec3 diffuse(PBRInfo pbrInputs)
226:{
227:    return pbrInputs.diffuseColor / M_PI;
228:}
229:
230:// The following equation models the Fresnel reflectance term of the spec equation (aka F())
231:// Implementation of fresnel from [4], Equation 15
232:vec3 specularReflection(PBRInfo pbrInputs, PBRLightInfo pbrLight)
233:{
234:    return pbrInputs.reflectance0 + (pbrInputs.reflectance90 - pbrInputs.reflectance0) * pow(clamp(1.0 - pbrLight.VdotH, 0.0, 1.0), 5.0);
235:}
236:
237:// This calculates the specular geometric attenuation (aka G()),
238:// where rougher material will reflect less light back to the viewer.
239:// This implementation is based on [1] Equation 4, and we adopt their modifications to
240:// alphaRoughness as input as originally proposed in [2].
241:float geometricOcclusion(PBRInfo pbrInputs, PBRLightInfo pbrLight)
242:{
243:    float NdotL = pbrLight.NdotL;
244:    float NdotV = pbrLight.NdotV;
245:    float r = pbrInputs.alphaRoughness;
246:
247:    float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
248:    float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
249:    return attenuationL * attenuationV;
250:}
251:
252:// The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())
253:// Implementation from "Average Irregularity Representation of a Roughened Surface for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
254:// Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.
255:float microfacetDistribution(PBRInfo pbrInputs, PBRLightInfo pbrLight)
256:{
257:    float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
258:    float f = (pbrLight.NdotH * roughnessSq - pbrLight.NdotH) * pbrLight.NdotH + 1.0;
259:    return roughnessSq / (M_PI * f * f);
260:}
261:
262:vec3 pbrModel(PBRInfo pbrInputs, vec3 lightColor, vec3 lightDir) {
263:
264:    vec3 n = getNormal();                             // normal at surface point
265:    vec3 v = normalize(CamDir);                       // Vector from surface point to camera
266:    vec3 l = normalize(lightDir);                     // Vector from surface point to light
267:    vec3 h = normalize(l+v);                          // Half vector between both l and v
268:    vec3 reflection = -normalize(reflect(v, n));
269:
270:    float NdotL = clamp(dot(n, l), 0.001, 1.0);
271:    float NdotV = abs(dot(n, v)) + 0.001;
272:    float NdotH = clamp(dot(n, h), 0.0, 1.0);
273:    float LdotH = clamp(dot(l, h), 0.0, 1.0);
274:    float VdotH = clamp(dot(v, h), 0.0, 1.0);
275:
276:    PBRLightInfo pbrLight = PBRLightInfo(
277:        NdotL,
278:        NdotV,
279:        NdotH,
280:        LdotH,
281:        VdotH
282:    );
283:
284:    // Calculate the shading terms for the microfacet specular shading model
285:    vec3 F = specularReflection(pbrInputs, pbrLight);
286:    float G = geometricOcclusion(pbrInputs, pbrLight);
287:    float D = microfacetDistribution(pbrInputs, pbrLight);
288:
289:    // Calculation of analytical lighting contribution
290:    vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
291:    vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
292:    // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
293:    vec3 color = NdotL * lightColor * (diffuseContrib + specContrib);
294:
295:    return color;
296:}
297:
298:void main() {
299:
300:    float perceptualRoughness = uRoughnessFactor;
301:    float metallic = uMetallicFactor;
302:
303:#ifdef HAS_METALROUGHNESSMAP
304:    // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
305:    // This layout intentionally reserves the 'r' channel for (optional) occlusion map data
306:    vec4 mrSample = texture2D(uMetallicRoughnessSampler, FragTexcoord);
307:    perceptualRoughness = mrSample.g * perceptualRoughness;
308:    metallic = mrSample.b * metallic;
309:#endif
310:
311:    perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
312:    metallic = clamp(metallic, 0.0, 1.0);
313:    // Roughness is authored as perceptual roughness; as is convention,
314:    // convert to material roughness by squaring the perceptual roughness [2].
315:    float alphaRoughness = perceptualRoughness * perceptualRoughness;
316:
317:    // The albedo may be defined from a base texture or a flat color
318:#ifdef HAS_BASECOLORMAP
319:    vec4 baseColor = SRGBtoLINEAR(texture2D(uBaseColorSampler, FragTexcoord)) * uBaseColor;
320:#else
321:    vec4 baseColor = uBaseColor;
322:#endif
323:
324:    vec3 f0 = vec3(0.04);
325:    vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
326:    diffuseColor *= 1.0 - metallic;
327:
328:    vec3 specularColor = mix(f0, baseColor.rgb, uMetallicFactor);
329:
330:    // Compute reflectance.
331:    float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
332:
333:    // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.
334:    // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflectance to 0%.
335:    float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
336:    vec3 specularEnvironmentR0 = specularColor.rgb;
337:    vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
338:
339:    PBRInfo pbrInputs = PBRInfo(
340:        perceptualRoughness,
341:        metallic,
342:        specularEnvironmentR0,
343:        specularEnvironmentR90,
344:        alphaRoughness,
345:        diffuseColor,
346:        specularColor
347:    );
348:
349://    vec3 normal = getNormal();
350:    vec3 color = vec3(0.0);
351:
352:#if AMB_LIGHTS>0
353:    // Ambient lights
354:    for (int i = 0; i < AMB_LIGHTS; i++) {
355:        color += AmbientLightColor[i] * pbrInputs.diffuseColor;
356:    }
357:#endif
358:
359:#if DIR_LIGHTS>0
360:    // Directional lights
361:    for (int i = 0; i < DIR_LIGHTS; i++) {
362:        // Diffuse reflection
363:        // DirLightPosition is the direction of the current light
364:        vec3 lightDirection = normalize(DirLightPosition(i));
365:        // PBR
366:        color += pbrModel(pbrInputs, DirLightColor(i), lightDirection);
367:    }
368:#endif
369:
370:#if POINT_LIGHTS>0
371:    // Point lights
372:    for (int i = 0; i < POINT_LIGHTS; i++) {
373:        // Common calculations
374:        // Calculates the direction and distance from the current vertex to this point light.
375:        vec3 lightDirection = PointLightPosition(i) - vec3(Position);
376:        float lightDistance = length(lightDirection);
377:        // Normalizes the lightDirection
378:        lightDirection = lightDirection / lightDistance;
379:        // Calculates the attenuation due to the distance of the light
380:        float attenuation = 1.0 / (1.0 + PointLightLinearDecay(i) * lightDistance +
381:            PointLightQuadraticDecay(i) * lightDistance * lightDistance);
382:        vec3 attenuatedColor = PointLightColor(i) * attenuation;
383:        // PBR
384:        color += pbrModel(pbrInputs, attenuatedColor, lightDirection);
385:    }
386:#endif
387:
388:#if SPOT_LIGHTS>0
389:    for (int i = 0; i < SPOT_LIGHTS; i++) {
390:
391:        // Calculates the direction and distance from the current vertex to this spot light.
392:        vec3 lightDirection = SpotLightPosition(i) - vec3(Position);
393:        float lightDistance = length(lightDirection);
394:        lightDirection = lightDirection / lightDistance;
395:
396:        // Calculates the attenuation due to the distance of the light
397:        float attenuation = 1.0 / (1.0 + SpotLightLinearDecay(i) * lightDistance +
398:            SpotLightQuadraticDecay(i) * lightDistance * lightDistance);
399:
400:        // Calculates the angle between the vertex direction and spot direction
401:        // If this angle is greater than the cutoff the spotlight will not contribute
402:        // to the final color.
403:        float angle = acos(dot(-lightDirection, SpotLightDirection(i)));
404:        float cutoff = radians(clamp(SpotLightCutoffAngle(i), 0.0, 90.0));
405:
406:        if (angle < cutoff) {
407:            float spotFactor = pow(dot(-lightDirection, SpotLightDirection(i)), SpotLightAngularDecay(i));
408:            vec3 attenuatedColor = SpotLightColor(i) * attenuation * spotFactor;
409:            // PBR
410:            color += pbrModel(pbrInputs, attenuatedColor, lightDirection);
411:        }
412:    }
413:#endif
414:
415:    // Calculate lighting contribution from image based lighting source (IBL)
416://#ifdef USE_IBL
417://    color += getIBLContribution(pbrInputs, n, reflection);
418://#endif
419:
420:    // Apply optional PBR terms for additional (optional) shading
421:#ifdef HAS_OCCLUSIONMAP
422:    float ao = texture2D(uOcclusionSampler, FragTexcoord).r;
423:    color = mix(color, color * ao, 1.0);//, uOcclusionStrength);
424:#endif
425:
426:#ifdef HAS_EMISSIVEMAP
427:    vec3 emissive = SRGBtoLINEAR(texture2D(uEmissiveSampler, FragTexcoord)).rgb * vec3(uEmissiveColor);
428:#else
429:    vec3 emissive = vec3(uEmissiveColor);
430:#endif
431:    color += emissive;
432:
433:    // Base Color
434://    FragColor = baseColor;
435:
436:    // Normal
437://    FragColor = vec4(n, 1.0);
438:
439:    // Emissive Color
440://    FragColor = vec4(emissive, 1.0);
441:
442:    // F
443://    color = F;
444:
445:    // G
446://    color = vec3(G);
447:
448:    // D
449://    color = vec3(D);
450:
451:    // Specular
452://    color = specContrib;
453:
454:    // Diffuse
455://    color = diffuseContrib;
456:
457:    // Roughness
458://    color = vec3(perceptualRoughness);
459:
460:    // Metallic
461://    color = vec3(metallic);
462:
463:    // Final fragment color
464:    FragColor = vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
465:}
466:
467:
468:


goroutine 1 [running, locked to thread]:
main.main()
	/Users/dobegor/go/src/github.com/g3n/g3nd/main.go:29 +0x70
exit status 2```

Installation fails.

Hello, I was trying to install the g3nd package and the installation fails import some header files. I have attached the output below.

  • System: Mac M1 running Darwin 20.5.0

Output

# github.com/go-gl/glfw/v3.2/glfw
In file included from ../../../go/pkg/mod/github.com/go-gl/[email protected]/v3.2/glfw/c_glfw_darwin.go:8:
../../../go/pkg/mod/github.com/go-gl/[email protected]/v3.2/glfw/glfw/src/cocoa_window.m:989:9: warning: multiple methods named 'center' found [-Wobjc-multiple-method-names]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCollectionViewCompositionalLayout.h:604:19: note: using
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:341:1: note: also found
# github.com/g3n/engine/audio/vorbis
../../../go/pkg/mod/github.com/g3n/[email protected]/audio/vorbis/vorbis.go:17:11: fatal error: 'codec.h' file not found
 #include "codec.h"
          ^~~~~~~~~
1 error generated.
# github.com/g3n/engine/audio/ov
../../../go/pkg/mod/github.com/g3n/[email protected]/audio/ov/vorbisfile.go:18:11: fatal error: 'vorbisfile.h' file not found
 #include "vorbisfile.h"
          ^~~~~~~~~~~~~~
1 error generated.
# github.com/g3n/engine/audio/al
../../../go/pkg/mod/github.com/g3n/[email protected]/audio/al/al.go:18:11: fatal error: 'al.h' file not found
 #include "al.h"
          ^~~~~~
1 error generated.

I have already run brew install libvorbis openal-soft and have added them to my path in line with the other issues that mention this error. Still, the installation fails.

Update
Running on Mac intel the brew install method works for the header files. However, in this case I get the following output and no binary is created.

# github.com/go-gl/glfw/v3.2/glfw
In file included from ../../../go/pkg/mod/github.com/go-gl/[email protected]/v3.2/glfw/c_glfw_darwin.go:8:
../../../go/pkg/mod/github.com/go-gl/[email protected]/v3.2/glfw/glfw/src/cocoa_window.m:989:9: warning: multiple methods named 'center' found [-Wobjc-multiple-method-names]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCollectionViewCompositionalLayout.h:604:19: note: using
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:341:1: note: also found

Request: File browser

I was wondering if you have a sample of file browser? i.e., click a button, open a dialog, choose file, and the get the path of the chosen file.

osx hit testing is off

on darwin, the hit testing of mouse clicks is off; I can't directly click the left side tree items and have the clicked one expand. Instead, one much farther down expands (implying it is probably the vertical click location computation that is bugged), or nothing happens at all.

go1.12.7, osx 10.13.6, g3nd 4a8cdd4, engine 6787e56af6f2a7173c5f5cc492bdc72c7d02cb37

edit: another example is on the gui->chart. I can't check and uncheck the check boxes.

Program freezes at grey screen on startup

$ go version
go version go1.8 linux/amd64

(Although this also occurred when I was using 1.6.2.) I am running Ubuntu GNOME 16.04.2. When I compile and run the program, by entering the directory and running go build, a plain gray window appears and nothing happens.

Here is the output when I invoke the program with ./g3nd -logs=gui:debug,gls:debug:

01:21:43.762537:I:G3ND:G3N Demo v0.1 starting
01:21:43.762569:I:G3ND:Set log level:DEBUG for package:GUI
01:21:43.762581:I:G3ND:Set log level:DEBUG for package:GLS
01:21:43.762597:I:G3ND:Using data directory:data
01:21:43.818911:I:G3ND:OpenGL version: 3.3 (Core Profile) Mesa 12.0.6
01:21:43.826131:I:G3ND:OpenAL Community version: 1.1 ALSOFT 1.16.0
01:21:43.826773:I:G3ND:Xiph.Org libVorbis 1.3.5
01:21:43.831008:W:G3N/GUI:Invalid panel width:-202
01:21:43.831717:W:G3N/GUI:Invalid panel width:-306
01:21:43.836590:W:G3N/GUI:Invalid panel width:-306
01:21:43.836635:W:G3N/GUI:Invalid panel height:-48
01:21:43.836653:W:G3N/GUI:Invalid panel width:-306
01:21:43.836663:W:G3N/GUI:Invalid panel height:-48
01:21:43.836671:W:G3N/GUI:Invalid panel width:-202
01:21:43.836677:W:G3N/GUI:Invalid panel height:-48

horizontal scroll in the 2D GUI

Everything works well on a mac, but the horizontal scroll does not quite work properly.

The best GUI control to test this is the "Scroller"

On the trackpad Vertical scroll works perfect. 2 fingers and it scrolls like silk.
For Horizontal, you have to move the cursor down onto the horizontal scrollbar, and then the 1 finger click and hold on the trackpad.

If i turn the "ScrollHorizontal" on, then the 2 finger horizontal works, so the API hooks do work for MAC. But you have to drag the 2 finger UP, to scroll horizontally.

So it feels like maybe a little bit of adjustment in the code is needed.

I can make a screenshot if needed.

shader compile error on mesa

On Ubuntu 16.04.2 with:
08:04:38.087191:I:G3ND:OpenGL version: 3.3 (Core Profile) Mesa 12.0.6
08:04:38.096676:I:G3ND:OpenAL Community version: 1.1 ALSOFT 1.16.0
08:04:38.097110:I:G3ND:Xiph.Org libVorbis 1.3.5

I get only a grey screen. With "-logs gui:debug" I get:

07:58:58.852209:W:G3N/GUI:Invalid panel width:-202
07:58:58.852699:W:G3N/GUI:Invalid panel width:-306
07:58:58.856393:W:G3N/GUI:Invalid panel width:-306
07:58:58.856438:W:G3N/GUI:Invalid panel height:-48
07:58:58.856451:W:G3N/GUI:Invalid panel width:-306
07:58:58.856471:W:G3N/GUI:Invalid panel height:-48
07:58:58.856478:W:G3N/GUI:Invalid panel width:-202
07:58:58.856484:W:G3N/GUI:Invalid panel height:-48

If I add a panic where the width is checked, I see this call stack:

github.com/g3n/engine/gui.(*Panel).SetSize(0xc42002fc00, 0xc34a0000)
/home/jra/src/github.com/g3n/engine/gui/panel.go:247 +0x1ce
github.com/g3n/engine/gui.(*Panel).SetWidth(0xc42002fc00, 0xc34a0000)
/home/jra/src/github.com/g3n/engine/gui/panel.go:261 +0x45
github.com/g3n/engine/gui.(*HBoxLayout).Recalc(0xc42054c200, 0xc61f80, 0xc420568000)
/home/jra/src/github.com/g3n/engine/gui/hboxlayout.go:127 +0x9d1

Adding this debug line before hboxlayout.go:127 gives "iwidth = (0 - 0 - 202 - 0) * 1 / 1"

log.Debug("iwidth = (%v - %v - %v - %v) * %v / %v", parent.ContentWidth(), spacing, fwidth, bl.spacing, params.Expand, texpand)

So parent.ContentWidth() is zero when you expect it to have already been set.

However, when I drag the corner to resize, I start getting lines like these, but the windows stays all grey.

08:20:55.529015:D:G3N/GUI:iwidth = (869 - 0 - 323 - 0) * 1 / 1
08:20:55.557535:D:G3N/GUI:iwidth = (872 - 0 - 323 - 0) * 1 / 1
08:20:55.582883:D:G3N/GUI:iwidth = (875 - 0 - 323 - 0) * 1 / 1
08:20:55.623262:D:G3N/GUI:iwidth = (879 - 0 - 323 - 0) * 1 / 1

I need to stop debugging there, good luck!

glad to have demos: multi viewport, and multi windows with separate scene inside,

as a beginner of opengl and 3D graphics, I would like to require such demos:

what I suppose:

  1. multi viewport: one scene, different camera , one camera for one viewport,

https://doc.qt.io/qt-5.10/images/multiviewport.png

  1. multi windows with separate scene inside:

sometimes we need to display several un-related scenes in one application, then I think viewport may not able to do this, maybe multi child windows are needed, each child window display a unique scene inside,
https://learnopengl.com/img/advanced-lighting/deferred_g_buffer.png

thanks!

BR fino

material->blending glitches

Hi,

I just tried the g3nd demo and I'm pretty impressed with it. Firstly, it builds and runs just fine (not every 3D framework/engine does this!). Object loading and textures works, and there is a wide selection of GUI controls. At a glance, the code also looks very clear and readable. Thanks for releasing it as open source!

The only issue I could spot were some artifacts when testing the blending:

blend mode

I'm on 64-bit Arch Linux with a Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller, using the i915 kernel module.

I would be happy to run test code on my system, if that would help.

Cheers!

error when build on windows

linux cross-compile .exe is OK
but on windows, build with mingw, there is an error ::

D:\Go\GOPATH\src\github.com\g3n\g3nd>go build

github.com/g3n/engine/text

..\engine\text\font.go:204: undefined: font.Metrics
..\engine\text\font.go:207: f.face.Metrics undefined (type font.Face has no field or method Metrics)

D:\Go\GOPATH\src\github.com\g3n\g3nd>go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\GO\GOPATH
set GORACE=
set GOROOT=D:\Go
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build917696419=/tmp/go-build -gno-record-g
cc-switches
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

I really like this project~ it's nice~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.