gowebgl

command module
v0.0.0-...-be50a85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2021 License: BSD-2-Clause Imports: 4 Imported by: 0

README

GoWebGL : Interactive Graphics in Go

Interactive 2D & 3D Graphics Library using Go + WebAssembly + WebGL

=========================================================
THIS PROJECT WAS MOVED TO A NEW REPOSITORY GIGL (May 9, 2021),
WHICH ALREADY INCLUDES SIGNIFICANT IMPROVEMENTS.
NO FURTHER DEVELOPMENT WILL BE MADE TO THIS PROJECT. =========================================================

How to Build & Run

Simplest example:   (for explaining how WebGL works)

$ make                  # source : 'webgl1st_example.go'
$ ./wasm_test_server    # open your browser, and visit http://localhost:8080

webgl1st_example result

2D example:   (with animation & user interactions)

$ make 2d               # source : 'webgl2d_example.go'
$ ./wasm_test_server    # open your browser, and visit http://localhost:8080
or
$ make 2dui             # source : 'webgl2dui_example.go'
$ ./wasm_test_server    # open your browser, and visit http://localhost:8080

webgl2d_example result

3D example:   (with perspective & orthographic camera)

$ make 3d               # source : 'webgl3d_example.go'
$ ./wasm_test_server    # open your browser, and visit http://localhost:8080

webgl3d_example result

Globe example:   (with perspective & orthographic camera)

$ make globe            # source : 'webglglobe_example.go'
$ ./wasm_test_server    # open your browser, and visit http://localhost:8080

webglglobe_example result

ToDo List

  • overlay (marker/label) layers for Globe
  • user selection using collision detection with a ray from camera
  • graticules on the globe
  • coast lines and country border lines on the world map
  • support for world map projections (Mercator, Stereographic, etc)
  • 'webglgalaxy' maybe? :)

Thanks

I hope this project can help many people to learn WebGL and to build awesome 2D & 3D graphics applications.
Many thanks to Richard Musiol, for his vision and contributions for GopherJS and WebAssembly for Go. If you hava a feedback or suggestion, contact go4orward.

Resources taken from:

Documentation

Overview

This code launches a simple HTTP server to test the pre-built WASM bundle (This code was inspired by https://github.com/bobcob7/wasm-basic-triangle)

Directories

Path Synopsis
+build js,wasm +build js,wasm +build js,wasm +build js,wasm
+build js,wasm +build js,wasm +build js,wasm +build js,wasm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL