Go 3D Game Engine

Overview

G3N Banner

Godoc Go Report Card

G3N - Go 3D Game Engine

G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that show rich and dynamic 3D representations - not just games. A basic integrated GUI framework is provided, and 3D spatial audio is supported through OpenAL.

To see G3N in action try the G3N demo or the Gokoban award winning game.

G3ND In Action

Highlighted Projects Using G3N

Dependencies

Go 1.8+ is required. The engine also requires the system to have an OpenGL driver and a GCC-compatible C compiler.

On Unix-based systems the engine depends on some C libraries that can be installed using the appropriate distribution package manager. See below for OS specific requirements.

Ubuntu/Debian-like

$ sudo apt-get install xorg-dev libgl1-mesa-dev libopenal1 libopenal-dev libvorbis0a libvorbis-dev libvorbisfile3

Fedora

$ sudo dnf -y install xorg-x11-proto-devel mesa-libGL mesa-libGL-devel openal-soft openal-soft-devel libvorbis libvorbis-devel glfw-devel libXi-devel

CentOS 7

Enable the EPEL repository:

$ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Then install the same packages as for Fedora - remember to use yum instead of dnf for the package installation command.

Windows

We tested the Windows build using the mingw-w64 toolchain (you can download this file in particular).

The necessary audio DLLs are supplied and need to be added to your PATH. If you would like to build the DLLs yourself you can find the libraries' source code and build instructions here.

macOS

Install the development files of OpenAL and Vorbis using Homebrew:

brew install libvorbis openal-soft

Installation

The following set of commands will download and install the engine along with all its Go dependencies:

git clone https://github.com/g3n/engine g3n-engine
cd g3n-engine
go install ./...

Features

  • Cross-platform: Windows, Linux, and macOS. (WebAssembly is 90% complete!)
  • Integrated GUI (graphical user interface) with many widgets
  • Hierarchical scene graph - nodes can contain other nodes
  • 3D spatial audio via OpenAL (.wav, .ogg)
  • Real-time lighting: ambient, directional, point, and spot lights
  • Physically-based rendering: fresnel reflectance, geometric occlusion, microfacet distribution
  • Model loaders: glTF (.gltf, .glb), Wavefront OBJ (.obj), and COLLADA (.dae)
  • Geometry generators: box, sphere, cylinder, torus, etc...
  • Geometries support morph targets and multimaterials
  • Support for animated sprites based on sprite sheets
  • Perspective and orthographic cameras
  • Text image generation and support for TrueType fonts
  • Image textures can be loaded from GIF, PNG or JPEG files
  • Animation framework for position, rotation, and scale of objects
  • Support for user-created GLSL shaders: vertex, fragment, and geometry shaders
  • Integrated basic physics engine (experimental/incomplete)
  • Support for HiDPI displays

G3N Banner

Hello G3N

The code below is a basic "hello world" application (hellog3n) that shows a blue torus and a button that when clicked makes the torus red:

package main

import (
	"github.com/g3n/engine/app"
	"github.com/g3n/engine/camera"
	"github.com/g3n/engine/core"
	"github.com/g3n/engine/geometry"
	"github.com/g3n/engine/gls"
	"github.com/g3n/engine/graphic"
	"github.com/g3n/engine/gui"
	"github.com/g3n/engine/light"
	"github.com/g3n/engine/material"
	"github.com/g3n/engine/math32"
	"github.com/g3n/engine/renderer"
	"github.com/g3n/engine/util/helper"
	"github.com/g3n/engine/window"
	"time"
)

func main() {

	// Create application and scene
	a := app.App()
	scene := core.NewNode()

	// Set the scene to be managed by the gui manager
	gui.Manager().Set(scene)

	// Create perspective camera
	cam := camera.New(1)
	cam.SetPosition(0, 0, 3)
	scene.Add(cam)

	// Set up orbit control for the camera
	camera.NewOrbitControl(cam)

	// Set up callback to update viewport and camera aspect ratio when the window is resized
	onResize := func(evname string, ev interface{}) {
		// Get framebuffer size and update viewport accordingly
		width, height := a.GetSize()
		a.Gls().Viewport(0, 0, int32(width), int32(height))
		// Update the camera's aspect ratio
		cam.SetAspect(float32(width) / float32(height))
	}
	a.Subscribe(window.OnWindowSize, onResize)
	onResize("", nil)

	// Create a blue torus and add it to the scene
	geom := geometry.NewTorus(1, .4, 12, 32, math32.Pi*2)
	mat := material.NewStandard(math32.NewColor("DarkBlue"))
	mesh := graphic.NewMesh(geom, mat)
	scene.Add(mesh)

	// Create and add a button to the scene
	btn := gui.NewButton("Make Red")
	btn.SetPosition(100, 40)
	btn.SetSize(40, 40)
	btn.Subscribe(gui.OnClick, func(name string, ev interface{}) {
		mat.SetColor(math32.NewColor("DarkRed"))
	})
	scene.Add(btn)

	// Create and add lights to the scene
	scene.Add(light.NewAmbient(&math32.Color{1.0, 1.0, 1.0}, 0.8))
	pointLight := light.NewPoint(&math32.Color{1, 1, 1}, 5.0)
	pointLight.SetPosition(1, 0, 2)
	scene.Add(pointLight)

	// Create and add an axis helper to the scene
	scene.Add(helper.NewAxes(0.5))

	// Set background color to gray
	a.Gls().ClearColor(0.5, 0.5, 0.5, 1.0)

	// Run the application
	a.Run(func(renderer *renderer.Renderer, deltaTime time.Duration) {
		a.Gls().Clear(gls.DEPTH_BUFFER_BIT | gls.STENCIL_BUFFER_BIT | gls.COLOR_BUFFER_BIT)
		renderer.Render(scene, cam)
	})
}

hellog3n Screenshot

You can download and install hellog3n via:

go get -u github.com/g3n/demos/hellog3n

For more complex demos please see the G3N demo program.

Documentation

The complete engine API reference can be found here: GoDoc.

There is also the beginning of a Getting Started Guide, and a newly created list of Guides and Tutorials:

Along with those, a good way to learn how to use the engine is to see the source code of G3ND - the G3N demo.

Contributing

If you find a bug or create a new feature you are encouraged to send pull requests!

Community

Join our channel on Gophers Slack (Click here to register for Gophers Slack). It's a great way to have your questions answered quickly by the G3N community.

Stargazers over time

Stargazers over time

Comments
  • Support for OpenGL 2.1/OpenGL ES 2.0?

    Support for OpenGL 2.1/OpenGL ES 2.0?

    At present, the minimum version of OpenGL required seems to be 3.3:

    https://github.com/g3n/engine/blob/9d6952a24f8b3f0ab877138f205b752b236af655/window/glfw.go#L77-L78

    Is there any interest in dropping that back to 2.1 / OpenGL ES 2.0, for wider support? eg Raspberry Pi class hardware

    Asking because I just went and tried it (that's my deployment target), and well... it's obviously not working at the moment. :wink:

    opened by justinclift 25
  • Should loader.Decode() support .obj files without a corresponding material?

    Should loader.Decode() support .obj files without a corresponding material?

    Asking because although the example files (eg gopher.obj, gopher.mtl) work fine, I have several .obj files without materials (generated by CAD programs).

    Was kind of thinking to import the obj files using loader.Decode(), then manually create + apply a material to each imported one.

    At the moment, loader.Decode() treats a missing material file as an error. Am kind of thinking it might be useful to allow it to proceed instead, and pass (say) nil to loader.DecodeReader() which would skip attempting to parse the missing material too.

    Can make a PR, which shouldn't suck too hard code wise. :wink:

    Thoughts? :smile:

    opened by justinclift 15
  • GLSL 3.30 does not allow indexing texture sampler with non constant values – crash

    GLSL 3.30 does not allow indexing texture sampler with non constant values – crash

    Related to #2, I'm not sure where that comes from:

    https://github.com/g3n/engine/blame/master/renderer/shaders/sources.go#L137 or renderer/shaders/include/material.glsl:35: vec4 texColor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i));

    ./g3nd 04:34:03.453577:I:G3ND:G3N Demo v0.6 starting 04:34:03.453624:I:G3ND:OpenGL version: 4.5 (Core Profile) Mesa 19.2.0-devel - padoka PPA 04:34:03.458111:I:G3ND:Using data directory:g3nd/data

    panic: error compiling Vertex Shader: 0:58(26): error: sampler arrays indexed with non-constant expressions are forbidden in GLSL 1.30 and later
    001:#version 330 core
    ...
    051:// GLSL 3.30 does not allow indexing texture sampler with non constant values.
    052:// This function is used to mix the texture with the specified index with the material color.
    053:// It should be called for each texture index. It uses two externally defined variables:
    054:// vec4 texColor
    055:// vec4 texMixed
    056:vec4 MIX_TEXTURE(vec4 texMixed, vec2 FragTexcoord, int i) {
    057:    if (MatTexVisible(i)) {
    058:        vec4 texColor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i));
    059:        if (i == 0) {
    060:            texMixed = texColor;
    061:        } else {
    062:            texMixed = mix(texMixed, texColor, texColor.a);
    063:        }
    064:    }
    065:    return texMixed;
    066:}
    ...
    
    goroutine 1 [running, locked to thread]:
    github.com/g3n/g3nd/app.(*App).Update(0xc0000a6460, 0xc000226580, 0xa9cb781)
    	g3nd/app/app.go:633 +0x2c8
    github.com/g3n/engine/app.(*Application).Run(0xc0000922a0, 0xc0000dbf28)
    	pkg/mod/github.com/g3n/[email protected]/app/app-desktop.go:87 +0x15b
    github.com/g3n/g3nd/app.(*App).Run(0xc0000a6460)
    	g3nd/app/app.go:614 +0x9f
    main.main()
    	g3nd/main.go:24 +0x27
    
    opened by capnm 13
  • Can't play Ogg Vorbis file

    Can't play Ogg Vorbis file

    Hi,

    I have an Ogg Vorbis audio file:

    % file test.ogg
    test.ogg: Ogg data, Vorbis audio, stereo, 48000 Hz, ~160000 bps, created by: Xiph.Org libVorbis I
    

    It plays fine with mpv:

    % mpv test.ogg 
    Playing: test.ogg
     (+) Audio --aid=1 (vorbis 2ch 48000Hz)
    File tags:
     Artist: Vårsol
    AO: [pulse] 48000Hz stereo 2ch float
    A: 00:00:01 / 00:05:24 (0%)
    [...]
    Exiting... (Quit)
    ^C
    

    However, when playing the file with these lines of code, I get a panic:

    	// Load Ogg Vorbis library
    	err = vorbis.Load()
    	if err != nil {
    		panic(err)
    	}
    	fmt.Println(vorbis.VersionString())
    
    	// Load audio
    	player, err := audio.NewPlayer("test.ogg")
    	if err != nil {
    		panic(err)
    	}
    
    	// Play audio
    	err = player.Play()
    	if err != nil {
    		panic(err)
    	}
    

    This is the output

    Xiph.Org libVorbis 1.3.5
    panic: Unsuported file type
    

    This is on 64-bit Arch Linux with Go 1.8 and libvorbis 1.3.5 (comes with libvorbisfile: /usr/lib/libvorbisfile.so.3.3.7).

    opened by xyproto 12
  • q: simple box

    q: simple box

    sorry for a really simple, basic question: I want to draw a box on a canvas, and color it red. Could you share an example of using g3n/engine for this? thanks!

    opened by glycerine 11
  • The program does not render examples

    The program does not render examples

    I use windows 64. Downloaded the engine from the gitnab and try to run the examples, such as "HelloG3n" or "gopher3d". But only new window appears and shows nothing. Nothing exept the background color. After I close the window programm ends with exit-code:0.

    I do not understand what's the matter! Please,I need your help!

    additionaly, the first time it got error, that it don't may use type int as argument of glfw.CreateStandartCursor in "glfw.go". This fragment introduced below: // Preallocate standard cursors w.arrowCursor = glfw.CreateStandardCursor(int(glfw.ArrowCursor)) w.ibeamCursor = glfw.CreateStandardCursor(int(glfw.IBeamCursor)) w.crosshairCursor = glfw.CreateStandardCursor(int(glfw.CrosshairCursor)) w.handCursor = glfw.CreateStandardCursor(int(glfw.HandCursor)) w.hresizeCursor = glfw.CreateStandardCursor(int(glfw.HResizeCursor)) w.vresizeCursor = glfw.CreateStandardCursor(int(glfw.VResizeCursor)) After this I remove all int from showed strings. But I don't think that it's reason...

    opened by SavostinVladimir 11
  • node.SetVisible() state ignored

    node.SetVisible() state ignored

    Just noticed something that seems weird.

    If a scene has several nodes (eg 3 boxes), then the node.SetVisible() call doesn't work as expected when all of the nodes have their visibility turned off.

    If only some of the nodes in the scene have their visibility turned off, then things work as expected. Those nodes disappear visually, and only the remaining nodes can be seen.

    However, when all nodes have their visibility turned off... none of them disappear. eg it's as if the several calls to node.SetVisible() are being ignored.

    Is this expected behaviour?

    Only asking because I'm noticing this while mucking around with engine/gui and buttons. The action of one is set to toggle visibility of various elements, and I noticed this seeming-edge-case. If this is behaviour as intended, then no worries. It's just a test button anyway. :smile:

    opened by justinclift 9
  • Audio dependency names for CentOS 7

    Audio dependency names for CentOS 7

    Just read the audio dependencies for CentOS in the README.md, so decided to investigate quickly:

    For CentOS/Fedora-like Linux distributions, install libopenal1 and libvorbisfile3 (to be verified)

    On my CentOS 7 x64 desktop, the needed package for OpenAL seems to be called "openal-soft" (available in the standard EPEL repo) instead of "libopenal1". There is a matching "openal-soft-devel" package too, but it doesn't seem to be needed when testing just now.

    For testing, I compiled g3nplay and ran it with the demo .ogg and .wav files.

    • Without openal-soft installed, an error message Error trying to load OpenAL library is displayed.
    • With just openal-soft installed (without the -devel package too) the .wav files (only) play back fine.
    • Adding the openal-soft-devel didn't seem to change anything. The .wav files played back fine again.

    For the .ogg demo files though, nothing seemed to work. Both the libvorbis and libogg packages were already installed on my desktop, but the .ogg files refused to play. As in, the g3nplay application proceeded as if there were... but no sound of any sort. Add the libogg-devel and libvorbis-devel packages then recompiling g3nplay didn't change anything.

    So... for at least the OpenAL stuff the package name is pretty clear. Not real sure about the libvorbis bits though. :wink:

    opened by justinclift 9
  • Create button_destructive.go

    Create button_destructive.go

    I don't know how to modify two files in a single PR so I'm having to submit this in parts so that g3n will continue to build successfully after each merge. It will be a series of 5 pull requests that you can merge in order and it should compile after each PR. This is the first in the series.

    This series of PRs introduces a new type, ButtonDestructive, which is extremely similar to Button (and uses it internally), but requires two clicks to activate. After the first click, the style and optionally the label text change to indicate that another click is necessary. If the mouse cursor leaves the widget then it is reset. If a second click happens then the associated (usually destructive, hence the name) subscribed action is called.

    opened by amyadzuki 8
  • [bug] incorrect preprocessor directive

    [bug] incorrect preprocessor directive

    g3n/engine commit: 1947ea87d4dc4603f0ecb3e14aadbcdee649c839

    Hello, I have a glsl compilation error whenever I try the latest version of g3n/g3nd or the sample application g3n/demos/hellog3n. I've not yet tested previous version of the engine but it seems related to the recent modifications of the glsl bone directives.

    OS: 64bit Mac OS X 10.13.6 17G65
    Kernel: x86_64 Darwin 17.7.0
    GPU: Intel Iris Pro / NVIDIA GeForce GT 750M
    

    I'm currently looking into it and but it might take me some time to make a working PR. I'm using a modified version of the g3n/demos/hello3gn where I added an error check to app.Run()

    $ go run main.go 
    13:39:14.317947:I::OpenGL version: 4.1 NVIDIA-10.32.0 355.11.10.10.40.102
    panic: error compiling Vertex Shader: ERROR: 0:84: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:84: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    ERROR: 0:128: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:128: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    ERROR: 0:131: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:131: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    ERROR: 0:133: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:133: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    ERROR: 0:135: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:135: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    001:#version 330 core
    002:#define AMB_LIGHTS 1
    003:#define DIR_LIGHTS 0
    004:#define POINT_LIGHTS 1
    005:#define SPOT_LIGHTS 0
    006:#define MAT_TEXTURES 0
    007://
    008:// Vertex Shader
    009://
    010:
    011://
    012:// Vertex attributes
    013://
    014:layout(location = 0) in  vec3  VertexPosition;
    015:layout(location = 1) in  vec3  VertexNormal;
    016:layout(location = 2) in  vec3  VertexColor;
    017:layout(location = 3) in  vec2  VertexTexcoord;
    018:layout(location = 4) in  float VertexDistance;
    019:layout(location = 5) in  vec4  VertexTexoffsets;
    020:
    021:
    022:// Model uniforms
    023:uniform mat4 ModelViewMatrix;
    024:uniform mat3 NormalMatrix;
    025:uniform mat4 MVP;
    026:
    027:
    028://
    029:// Material properties uniform
    030://
    031:
    032:// Material parameters uniform array
    033:uniform vec3 Material[6];
    034:// Macros to access elements inside the Material array
    035:#define MatAmbientColor             Material[0]
    036:#define MatDiffuseColor     Material[1]
    037:#define MatSpecularColor    Material[2]
    038:#define MatEmissiveColor    Material[3]
    039:#define MatShininess        Material[4].x
    040:#define MatOpacity          Material[4].y
    041:#define MatPointSize        Material[4].z
    042:#define MatPointRotationZ   Material[5].x
    043:
    044:#if MAT_TEXTURES > 0
    045:    // Texture unit sampler array
    046:    uniform sampler2D MatTexture[MAT_TEXTURES];
    047:    // Texture parameters (3*vec2 per texture)
    048:    uniform vec2 MatTexinfo[3*MAT_TEXTURES];
    049:    // Macros to access elements inside the MatTexinfo array
    050:    #define MatTexOffset(a)         MatTexinfo[(3*a)]
    051:    #define MatTexRepeat(a)         MatTexinfo[(3*a)+1]
    052:    #define MatTexFlipY(a)          bool(MatTexinfo[(3*a)+2].x)
    053:    #define MatTexVisible(a)        bool(MatTexinfo[(3*a)+2].y)
    054:#endif
    055:
    056:// GLSL 3.30 does not allow indexing texture sampler with non constant values.
    057:// This macro is used to mix the texture with the specified index with the material color.
    058:// It should be called for each texture index. It uses two externally defined variables:
    059:// vec4 texColor
    060:// vec4 texMixed
    061:#define MIX_TEXTURE(i)                                                                       \
    062:    if (MatTexVisible(i)) {                                                                  \
    063:        texColor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i)); \
    064:        if (i == 0) {                                                                        \
    065:            texMixed = texColor;                                                             \
    066:        } else {                                                                             \
    067:            texMixed = mix(texMixed, texColor, texColor.a);                                  \
    068:        }                                                                                    \
    069:    }
    070:
    071:// TODO for alpha blending dont use mix use implementation below (similar to one in panel shader)
    072:            //vec4 prevTexPre = texMixed;                                                      \
    073:            //prevTexPre.rgb *= prevTexPre.a;                                                  \
    074:            //vec4 currTexPre = texColor;                                                      \
    075:            //currTexPre.rgb *= currTexPre.a;                                                  \
    076:            //texMixed = currTexPre + prevTexPre * (1 - currTexPre.a);                         \
    077:            //texMixed.rgb /= texMixed.a;
    078:
    079:#ifdef MORPHTARGETS
    080:    uniform float morphTargetInfluences[MORPHTARGETS];
    081:    
    082:#endif
    083:
    084:#if BONE_INFLUENCERS > 0
    085:    uniform mat4 mBones[TOTAL_BONES];
    086:    in vec4 matricesIndices;
    087:    in vec4 matricesWeights;
    088://    #if BONE_INFLUENCERS > 4
    089://        in vec4 matricesIndicesExtra;
    090://        in vec4 matricesWeightsExtra;
    091://    #endif
    092:#endif
    093:// Output variables for Fragment shader
    094:out vec4 Position;
    095:out vec3 Normal;
    096:out vec3 CamDir;
    097:out vec2 FragTexcoord;
    098:
    099:void main() {
    100:
    101:    // Transform this vertex position to camera coordinates.
    102:    Position = ModelViewMatrix * vec4(VertexPosition, 1.0);
    103:
    104:    // Transform this vertex normal to camera coordinates.
    105:    Normal = normalize(NormalMatrix * VertexNormal);
    106:
    107:    // Calculate the direction vector from the vertex to the camera
    108:    // The camera is at 0,0,0
    109:    CamDir = normalize(-Position.xyz);
    110:
    111:    // Flips texture coordinate Y if requested.
    112:    vec2 texcoord = VertexTexcoord;
    113:#if MAT_TEXTURES>0
    114:    if (MatTexFlipY(0)) {
    115:        texcoord.y = 1 - texcoord.y;
    116:    }
    117:#endif
    118:    FragTexcoord = texcoord;
    119:    vec3 vPosition = VertexPosition;
    120:    mat4 finalWorld = mat4(1.0);
    121:    
    122:#ifdef MORPHTARGETS
    123:
    124:    
    125:
    126:#endif
    127:
    128:#if BONE_INFLUENCERS > 0
    129:
    130:    mat4 influence = mBones[int(matricesIndices[0])] * matricesWeights[0];
    131:    #if BONE_INFLUENCERS > 1
    132:        influence += mBones[int(matricesIndices[1])] * matricesWeights[1];
    133:        #if BONE_INFLUENCERS > 2
    134:            influence += mBones[int(matricesIndices[2])] * matricesWeights[2];
    135:            #if BONE_INFLUENCERS > 3
    136:                influence += mBones[int(matricesIndices[3])] * matricesWeights[3];
    137://                #if BONE_INFLUENCERS > 4
    138://                    influence += mBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
    139://                    #if BONE_INFLUENCERS > 5
    140://                        influence += mBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
    141://                        #if BONE_INFLUENCERS > 6
    142://                            influence += mBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
    143://                            #if BONE_INFLUENCERS > 7
    144://                                influence += mBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
    145://                            #endif
    146://                        #endif
    147://                    #endif
    148://                #endif
    149:            #endif
    150:        #endif
    151:    #endif
    152:
    153:    finalWorld = finalWorld * influence;
    154:
    155:#endif
    156:gl_Position = MVP * finalWorld * vec4(vPosition, 1.0);
    157:}
    158:
    159:
    
    
    goroutine 1 [running, locked to thread]:
    main.check(0x4229520, 0xc420010aa0)
            /Users/rdantzer/GO/src/github.com/raphy42/playground/main.go:14 +0x4a
    main.main()
            /Users/rdantzer/GO/src/github.com/raphy42/playground/main.go:45 +0x2c6
    exit status 2
    
    opened by Raphy42 8
  • Can't install the engine

    Can't install the engine

    Hi after running "go get -u github.com/g3n/engine/...", it throws error like this:

    # github.com/go-gl/glfw/v3.2/glfw
    In file included from go/src/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:24:0:
    go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c: In function ‘_glfwInitJoysticksLinux’:
    go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c:224:42: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 9 [-Wformat-truncation=]
                 snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
                                              ^~~~~~~
    In file included from /usr/include/stdio.h:862:0,
                     from /usr/include/X11/Xcursor/Xcursor.h:26,
                     from go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_platform.h:39,
                     from go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/internal.h:169,
                     from go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_init.c:28,
                     from go/src/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:19:
    /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 12 and 267 bytes into a destination of size 20
       return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            __bos (__s), __fmt, __va_arg_pack ());
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

    I did install all the necessary packages, I am running Ubuntu 18.04 LTS, Go 1.10.1 in VirtualBox.

    opened by Nickan 8
  • MacOS with Retina: UI clickable area is calculated incorrectly

    MacOS with Retina: UI clickable area is calculated incorrectly

    Most likely bug is caused by incorrect calculation of UI element position due to Retina. See video for a reproduction. I used an example code from the readme.md

    https://user-images.githubusercontent.com/820057/183709276-7f04556c-5cc8-4ad5-b405-e5fde9a16b60.mov

    opened by dant3 4
  • MacOS: fuzzy font on Retina

    MacOS: fuzzy font on Retina

    I'm trying to run an example from the readme.md of the engine on a mac. The button text looks really fuzzy. Looks as if some antialiasing is missing. Most likely the problem is because Retina is not supported. My system is MacBook Pro (16-inch, 2019).

    image

    P.S. Sorry for the camera photo, but there is no way I can demonstrate this with the screenshot -- since the problem is caused by Retina.

    opened by dant3 1
  • How to tell if the click is on the UI or an object in the game

    How to tell if the click is on the UI or an object in the game

    Excuse me, I use the ray to click the screen to move, but how do I judge whether the click is the UI or the scene in the game, and how to set the penetration filter of the ray

    opened by 529124368 1
  • Render starts to lag when I draw a lot of objects

    Render starts to lag when I draw a lot of objects

    Render starts to lag when I draw a lot of objects. In Unity, you can choose to render only objects visible by the camera. Is there the same option in g3n?

    opened by fwflunky 2
Releases(v0.2.0)
Owner
G3N - Go 3D Game Engine Repositories
G3N - Go 3D Game Engine Repositories
FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this

GoPlus 2 Jan 10, 2022
FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this

GoPlus 2 Jan 10, 2022
MazePlay - a game powered by Go+ spx game engine

MazePlay - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this g

GoPlus 1 Dec 16, 2021
A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!

galactic-asteroid-belt Overview A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy! Run To run, you will need Go

null 0 Dec 2, 2021
RundQuiz-Game - This is a Go exercise that implements and builds a quiz game from a list of math questions in a CSV file.

Go RundQuiz Game Exercise details This exercise is broken into two parts to help simplify the process of explaining it as well as to make it easier to

IkehAkinyemi 0 Jan 5, 2022
Simple 2D game to teach myself various things about game development and ECS, etc

2d-grass-game I really don't know what to name this game. Its a big grass field, and its in 2d so....2D Grass game This is a simple 2D game to teach m

James Wynne III 1 Jan 17, 2022
Engo is an open-source 2D game engine written in Go.

Engo A cross-platform game engine written in Go following an interpretation of the Entity Component System paradigm. Engo is currently compilable for

Engo 1.5k Oct 1, 2022
Go 3D Game Engine

G3N - Go 3D Game Engine G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that

G3N - Go 3D Game Engine Repositories 2.1k Sep 24, 2022
Scalable Distributed Game Server Engine with Hot Swapping in Golang

GoWorld Scalable Distributed Game Server Engine with Hot Reload in Golang Features Architecture Introduction Get GoWorld Manage GoWorld Servers Demos

Nan Lin 2.2k Sep 26, 2022
A pure Go game engine

Oak A pure Go game engine Table of Contents Installation Motivation Features Support Quick Start Implementation and Examples Finished Games Installati

Oakmound Studio 1.3k Oct 3, 2022
Terminal-based game engine for Go, built on top of Termbox

Termloop Termloop is a pure Go game engine for the terminal, built on top of the excellent Termbox. It provides a simple render loop for building game

Joel Auterson 1.3k Sep 16, 2022
A 2D ARPG game engine.

Abyss Engine is an ARPG game engine in the same vein of the 2000's games, and supports playing games similar to Diablo 2. The engine is written in golang and is cross platform. This engine does not ship with game specific files, and will require a game's assets in order to run.

OpenDiablo2 58 Sep 11, 2022
A small fantasy game engine in WASM using GoLang

The GoLang Fantasy Engine (GoLF Engine) is a retro game engine. It draws inspiration from fantasy console projects like pico-8, tic-80, and pyxle. Like those projects it is designed to be a retro-feeling game creation/playing tool. Unlike those projects GoLF is more minimal in scope and only provides an API and a small set of tools to help you create your games. Tools like an image editor and code editor are not built in. Despite this minimalism creating games in GoLF is still easy and should still maintain the retro game feel.

Brandon Atkinson 87 Jul 16, 2022
golang powered game engine

Gobatch Go powered engine that offers features from low level opengl abstraction to UI framework. I created this to separate lot of logic from game am

Jakub Dóka 44 Sep 1, 2022
spx - A 2D Game Engine for learning Go+

spx - A 2D Game Engine for learning Go+ Tutorials How to run spx tutorials? Download Go+ and build it. See https://github.com/goplus/gop#how-to-build.

GoPlus 75 Sep 20, 2022
Go Game Engine using SDL for fun

nMage nMage is a (hopefully!) high performance 3D Game Engine written in Go being developed live, with recordings posted on YouTube. This project is b

Omar Mahdi 55 Sep 10, 2022
HelloSpx - Hello world of Go+ spx game engine

HelloSpx - Hello world of Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this game

null 1 Nov 27, 2021
HelloWorldForSpx - Hello world of Go+ spx game engine

HelloWorldForSpx - Hello world of Go+ spx game engineHelloWorldForSpx - Hello world of Go+ spx game engine

孙其瑞 3 Nov 22, 2021
A dead simple 2D game library for Go

Ebiten (v2) A dead simple 2D game library for Go Ebiten is an open source game library for the Go programming language. Ebiten's simple API allows you

Hajime Hoshi 7.1k Sep 25, 2022