In the long term, a lot of this package should be removed in favor of the
golang.org/x/image/math/f32 package. The latter is the common location for
matrix types shared across graphics libraries. For example, the
golang.org/x/image/draw package refers to golang.org/x/image/math/f64.
Change-Id: I9d7ccd3cb35912e0d9dc5bd46c919516ea840340
Reviewed-on: https://go-review.googlesource.com/11856
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This does not break the dependency on the app package's AndroidContext
for loading assets on android. A potential answer for gobind-based
apps: add a SetAndroidContext method to app.Context. But I'll explore
that separately after the long weekend.
Change-Id: I812f899740e288c379eee7900f42d9d53926d4ce
Reviewed-on: https://go-review.googlesource.com/11675
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Historically, the app package implemented Go runtime initialization.
This was convoluted, so the package was used both by all-Go apps
(currently based on Android's NativeActivity) and bind-based apps.
With Go 1.5 we have -buildmode=c-shared, which does a lot of the work
of the old app package. That code was removed a while back, but both
all-Go and gobind-based apps still used package app. The intermingled
initialization processes led to some strange states.
This CL separates gobind-based apps completely from the app package.
As part of that users are now expected to use System.loadLibrary
themselves. (A future CL may want to make the loadLibrary call part
of the .aar generated by gomobile bind.)
Delete the libhello example, which has been replaced by gomobile bind,
which could do with its own example at some point. Also delete the
libhellojni example, which now has nothing to do with the x/mobile
repository.
Change-Id: I444397f246dbafe81e5c53532eb482c197d26f70
Reviewed-on: https://go-review.googlesource.com/11654
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
Destroy sounds like C, we should use Close in Go.
Change-Id: I73da732300a955e458513f15ad898b7f34c8ed7c
Reviewed-on: https://go-review.googlesource.com/9875
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This app makes a sound as the gopher hits the edges of the screen.
Change-Id: I85c7d55ec88b1a9faec5dfb7b29e03d1149f5d65
Reviewed-on: https://go-review.googlesource.com/9698
Reviewed-by: Nigel Tao <nigeltao@golang.org>
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>
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>
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.
Resolvesgolang/go#10218.
Change-Id: Ib33dfff7c22c4d178b2e6b8d228f80f3c17308a8
Reviewed-on: https://go-review.googlesource.com/8000
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Add necessary files to build and run example/sprite.
Change main.go to get image from assets.
Change-Id: Ic3065aab97f59c34f2c0446ab4b46840305b5864
Reviewed-on: https://go-review.googlesource.com/1882
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Add windows batch files to build and run examples
Change-Id: I9102ceb5c47f692730a8b024648b1d10ff49b624
Reviewed-on: https://go-review.googlesource.com/1622
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Change-Id: If8ea6aaf2fb2c62eaf4119526a8bb46b8a84b982
Reviewed-on: https://go-review.googlesource.com/1881
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Moved to github.com/crawshaw/gopher3d for now, to simplify
the licensing story for the go.mobile subprepository.
LGTM=hyangah
R=hyangah
CC=golang-codereviews
https://golang.org/cl/182550043
"# 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
This example now uses the pre-L build system.
A gradle-based example will follow as soon as
I am testing on Android L devices.
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/143900043
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