Commit Graph

12 Commits

Author SHA1 Message Date
Nigel Tao c7c93d6952 app/debug: move to exp/app/debug.
Change-Id: I97f3585ff155e8c5b95c5bb32cfa793980c81a9a
Reviewed-on: https://go-review.googlesource.com/11821
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-30 23:41:11 +00:00
Nigel Tao 42f0d17876 app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.

Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.

As side-effects:
  - In package app/debug, DrawFPS now takes an explicit Config.
  - In package app, some callbacks now take an explicit Config.
  - In package exp/sprite, Render now takes an explicit Config.
  - In package event, there are new events (Config, Draw, Lifecycle),
    and an event filter mechanism to replace multiple app Callbacks.
  - In package geom, the deprecated Width, Height and PixelsPerPt global
    variables were removed in favor of an event.Config that is
    explicitly passed around (and does not require mutex-locking).
    Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
  - In package gl, the Do, Start and Stop functions are removed, as well
    as the need to call Start in its own goroutine. There is no longer a
    separate GL thread. Instead, package app explicitly performs any GL
    work (gl.DoWork) when some is available (gl.WorkAvailable).
  - In package gl/glutil, Image.Draw now takes an explicit Config.

Callbacks are no longer executed on 'the UI thread'.

Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.

Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-26 07:43:17 +00:00
Burcu Dogan 88e68e02f0 example/basic,example/sprite: give a reference to gomobile installation
Removing the duplicate installation instructions and giving a reference
to the gomobile godoc.

Change-Id: I476e4a4f4545eeb17d9ba18f471076d63c1f15d1
Reviewed-on: https://go-review.googlesource.com/9631
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-01 20:58:37 +00:00
Burcu Dogan 717c2c4312 example/basic: add build instructions for gomobile
This CL also removes Android build system required files and keeping
it to the bare minimum to what gomobile requires.

Fixes #10523.

Change-Id: Iabf16e7ea040a74eaf64746e7cc4e23ef3683af2
Reviewed-on: https://go-review.googlesource.com/9204
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-04-24 23:59:43 +00:00
Dmitri Shuralyov eaba00bca5 gl: use better spec-defined func names, fix bug, increase consistency
Change func names and parameter order to more closely follow OpenGL
ES/WebGL spec.
    BufferData(target, usage, src) -> BufferData(target, src, usage)
    GenBuffer -> CreateBuffer
    GenFramebuffer -> CreateFramebuffer
    GenRenderbuffer -> CreateRenderbuffer
    GenTexture -> CreateTexture
Fix issue where glBoolean helper was returning inverted result.
Make Attrib.String() logic consistent with others (print value, not
struct).
Make internal code of GetUniformLocation the same as GetAttribLocation
and BindAttribLocation for consistency.
Resolves golang/go#10218.

Change-Id: Ib33dfff7c22c4d178b2e6b8d228f80f3c17308a8
Reviewed-on: https://go-review.googlesource.com/8000
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-25 21:38:11 +00:00
David Crawshaw 1aa04cf038 app: Start and Stop callbacks
Change-Id: If8ea6aaf2fb2c62eaf4119526a8bb46b8a84b982
Reviewed-on: https://go-review.googlesource.com/1881
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-19 19:01:54 +00:00
Andrew Gerrand 9470e0ba58 go.mobile: use golang.org/x/... import paths
LGTM=bradfitz, rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/162710043
2014-11-10 08:55:57 +11:00
Nigel Tao 2457abfa93 go.mobile/f32: add a f32.Bytes function.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/166720044
2014-10-29 09:19:38 +11:00
Nigel Tao f458564116 go.mobile/example/basic: strip the "core" from the shaders'
"# version 100 core", as Ubuntu 14.04's OpenGLES doesn't like it:
"shader compile: 0:1(10): error: illegal text following version number"

LGTM=adg, crawshaw
R=crawshaw, bryanturley, adg
CC=golang-codereviews
https://golang.org/cl/163260043
2014-10-28 12:08:26 +11:00
David Crawshaw 12badfbcea go.mobile/example/basic: fix build
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/145470043
2014-09-29 05:17:34 +10:00
David Crawshaw 3fd6804d3e go.mobile/example/basic: respond to touch events
LGTM=nigeltao
R=nigeltao
CC=adg, bryanturley, davidday, golang-codereviews
https://golang.org/cl/139440043
2014-09-11 19:14:12 -04:00
David Crawshaw f3dc0a9c65 go.mobile/example/basic: app that draws a triangle
This is the first example of an App written entirely in Go that
draws to the device screen. Build and run process is driven
entirely by all.bash, no need for the Android Studio button
mashing in the lib* examples.

LGTM=nigeltao
R=golang-codereviews, nigeltao, bryanturley
CC=golang-codereviews
https://golang.org/cl/130420043
2014-09-09 20:25:47 -04:00