Commit Graph

517 Commits

Author SHA1 Message Date
Nigel Tao 0d93f8d8be go.mobile/app: tabs/spaces clean-up.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/159820043
2014-10-13 21:04:04 +11:00
David Crawshaw 17b03aaff9 go.mobile: a test for glutil.Image
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/152420043
2014-10-12 18:01:54 -07:00
David Crawshaw 8a5f40b7b3 go.mobile: move glimage to glutil package and export
Drawing now supports defining both the source and destination
bounds, which is equivalent to clipping and scaling an image.

LGTM=nigeltao
R=nigeltao, crawshaw
CC=adg, golang-codereviews
https://golang.org/cl/144480043
2014-10-12 17:58:22 -07:00
Nigel Tao c2d8ff3468 go.mobile/app: add an X11 implementation, for non-Android Linux.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/155270043
2014-10-13 09:24:05 +11:00
Nigel Tao 2b51510f07 go.mobile/sprite: use clock.Time instead of sprite.Time.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/156950044
2014-10-13 09:09:32 +11:00
Gautham Thambidorai 7aa683c173 go.mobile/app: Add an entrypoint for non Java libraries to use for initializing a go runtime.
LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/156040044
2014-10-09 14:23:40 -07:00
Nigel Tao 4f42fa989e go.mobile/gl: use column major ordering.
Also rename some files:
types.go      -> types_prod.go
typesdebug.go -> types_debug.go
(new file)       types_common.go

In discussing https://golang.org/cl/144480043/ crawshaw said:

The third argument to glUniformMatrix* is "transpose." According to the
linked documentation, which is usually better:

"If transpose is GL_FALSE, each matrix is assumed to be supplied in
column major order. If transpose is GL_TRUE, each matrix is assumed to
be supplied in row major order."

However, the documentation for OpenGL ES 2 doesn't bother even telling
you, it just says that this parameter must always be set to GL_FALSE. So
it's not supported on most Android devices. (Sadly the older
documentation appears to have been discontinued.)

So yes, GL seems to default to column-major, and the older GLES2 I'm
targeting left the transpose argument in but doesn't support it. Hence
I'm not exposing it through this API.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/148690043
2014-10-09 14:00:00 +11:00
Nigel Tao 6d01e6fdd5 go.mobile/f32: add Scale, Translate and Rotate methods to Affine.
Also make Mat4 methods consistent with Affine's methods.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/156000043
2014-10-09 13:48:17 +11:00
David Crawshaw 07f3aef267 go.mobile/sprite/clock: Time type and Cubic Bezier tween functions
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/151120043
2014-10-07 12:19:04 -07:00
David Crawshaw c7a16f3e6b go.mobile/sprite: use f32.Affine and draw to backing image
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/146150043
2014-10-03 14:56:54 +10:00
Nigel Tao 925df10ad0 go.mobile/f32: make matrix multiplication work even if the dst matrix
is the same as an arg matrix.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/152850043
2014-10-03 14:33:15 +10:00
Nigel Tao d3df5eca0b go.mobile/f32: fix matrix multiply to be m0*m1 not m1*m0.
Also fix String methods' receivers to be T, not *T, so that
var m f32.Mat32
s := fmt.Sprintf("m=%v", m)
works.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/147490043
2014-10-03 12:33:49 +10:00
Nigel Tao 52d35457e3 go.mobile/f32: add an Affine type.
Also fix the f32_test.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/149310043
2014-10-03 09:25:48 +10:00
Nigel Tao fac63c531f go.mobile/sprite: initial check-in.
Mostly just a design sketch for now.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/150390043
2014-10-02 13:25:02 +10:00
Nigel Tao 4313b67f84 go.mobile/f32: make Mat4.Translate take a pointer, to be consistent
with the other methods.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/147420043
2014-10-02 09:35:09 +10:00
Nigel Tao 75e726bb56 go.mobile/f32: add a Mat3 type.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/150380043
2014-10-01 13:51:19 +10:00
David Crawshaw 5217175bab go.mobile/app: darwin window drawing support for debugging
This lets you run really simple apps in a window on an OS X
machine. It's not an official target, but slightly more
productive than waiting for an apk install when working on
the sprite package.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/147910043
2014-09-29 13:22:23 +10:00
David Crawshaw 659ad767f0 go.mobile/testdata: add some small gophers
LGTM=adg
R=adg, nigeltao
CC=golang-codereviews
https://golang.org/cl/151840043
2014-09-29 07:53:16 +10: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 39b42192b2 go.mobile/geom: introduce Rectangle
LGTM=adg
R=adg, nigeltao
CC=golang-codereviews
https://golang.org/cl/151820043
2014-09-29 05:13:18 +10:00
Andrew Gerrand 98ca0ae78e go.mobile: add Dockerfile for portable build environment
This Dockerfile provides a base environment for building
Go Android apps. It can build example/basic, and that's
where I stopped for today.

$ docker build -t mobile /path/to/go.mobile
$ docker run --rm mobile /bin/bash -c 'cd example/gopher && ./make.bash'

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/151010043
2014-09-28 16:09:12 +10:00
David Crawshaw 7f2ffa1c58 go.mobile/app: remove enum not defined in earlier android platforms
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/143680044
2014-09-28 08:22:16 +10:00
David Crawshaw 4ea61e7184 go.mobile/sprite/portable: affine transform
This code is an import from my long-defunct graphics
library, code.google.com/p/graphics-go. It was
reviewed by nigeltao back in the day.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/142520043
2014-09-27 03:10:15 +10:00
David Crawshaw 022508a5a3 go.mobile/app/debug: basic GL-based debugging tools
LGTM=nigeltao
R=nigeltao, bryanturley, crawshaw
CC=adg, davidday, golang-codereviews
https://golang.org/cl/136550043
2014-09-22 11:18:43 -04:00
David Crawshaw 8439ecbf6b go.mobile/example/gopher: import generated gopher data
As you can't see it in the review tool, there is a copyright
notice in gopher.obj:

The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)
The gopher 3D model was made by Takuya Ueda (http://u.hinoichi.net).
Licensed under the Creative Commons 3.0 Attributions license.

Model from http://github.com/golang-samples/gopher-3d

LGTM=adg, nigeltao
R=nigeltao, adg, bryanturley
CC=davidday, golang-codereviews
https://golang.org/cl/143840044
2014-09-17 18:38:43 -04:00
David Crawshaw 400bc443a2 go.mobile/example/gopher: parse wavefront obj file
LGTM=nigeltao
R=nigeltao, adg
CC=davidday, golang-codereviews
https://golang.org/cl/139510043
2014-09-17 18:35:56 -04:00
David Crawshaw 79cb3f5193 go.mobile/README: update libhello instructions
LGTM=adg
R=adg, golang-codereviews
CC=golang-codereviews
https://golang.org/cl/141480044
2014-09-17 18:12:08 -04:00
David Crawshaw 7384be2e72 go.mobile/f32: float32 math library
I apologise for the poor state of this library.
I hope to improve it significantly soon. Right
now it exists to support example/gopher and the
debug library.

LGTM=nigeltao
R=nigeltao, bryanturley
CC=adg, davidday, golang-codereviews
https://golang.org/cl/141440043
2014-09-17 18:11:21 -04:00
David Crawshaw b1ea4eba37 go.mobile/gl: f32 utilities and extra debugging
Split constants out into their own file. Hide the
values in named types in a struct, so that when
using the gldebug tag we can attach extra
information (such as the name of a uniform and
attribute).

LGTM=nigeltao
R=golang-codereviews, bryanturley, nigeltao
CC=davidday, golang-codereviews
https://golang.org/cl/137630043
2014-09-17 18:07:50 -04:00
David Crawshaw 7dcf08fb02 go.mobile/example/libhello: make example self-contained
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
2014-09-12 10:54:02 -04:00
David Crawshaw 3b555d82f6 go.mobile/bind/java: fix build
I really need to sort out a builder story for end-to-end apps.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/136580043
2014-09-12 10:53:03 -04:00
David Crawshaw f0835e57bf go.mobile/README: update with more build instructions
LGTM=adg
R=golang-codereviews, adg, lucio.dere
CC=golang-codereviews
https://golang.org/cl/137490043
2014-09-12 05:44:53 -04:00
David Crawshaw 56cb2dac4e go.mobile/app: Touch callback
LGTM=adg, nigeltao
R=nigeltao, adg, bryanturley
CC=davidday, golang-codereviews
https://golang.org/cl/140450043
2014-09-11 19:39:16 -04: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 1a7379ccf0 go.mobile/event: types for user input events, starting with touch
LGTM=adg, nigeltao
R=nigeltao, bryanturley, adg, crawshaw
CC=davidday, golang-codereviews
https://golang.org/cl/141060043
2014-09-09 20:54:51 -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
David Crawshaw e27dbf7bf9 go.mobile/app: an exceedingly simple display loop
Missing many features (like event processing). This is
just enough to get example/basic working.

LGTM=nigeltao
R=golang-codereviews, capnm9, bryanturley, nigeltao, crawshaw
CC=golang-codereviews
https://golang.org/cl/131030043
2014-09-09 19:51:04 -04:00
David Crawshaw 1d1714ebe9 go.mobile/gl/glutil: OpenGL utilities package
No tests yet. I am working on a gltest package that can
create a windowless context on a variety of platforms for
testing GL code, but given current priorities it is a
couple of weeks away.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/135450043
2014-09-05 14:02:43 -04:00
David Crawshaw 0a1cd6409e go.mobile/geom: coordinate system and unit of length
LGTM=nigeltao
R=nigeltao, ruiu
CC=adg, davidday, golang-codereviews
https://golang.org/cl/140940044
2014-09-04 09:02:06 -04:00
David Crawshaw d56aee7394 go.mobile/example: give library examples a lib prefix
LGTM=nigeltao
R=golang-codereviews, nigeltao
CC=golang-codereviews
https://golang.org/cl/130910043
2014-09-03 09:28:47 -04:00
David Crawshaw 6acad32cab go.mobile/gl: import OpenGL 2 ES headers
Various versions of these headers cause harmless (but frustrating)
compile errors, e.g. *C.char being swapped out in some function
definitions for *C.uchar. To simplify builds, importing the
headers from khronos.org.

LGTM=nigeltao
R=golang-codereviews, nigeltao
CC=golang-codereviews
https://golang.org/cl/127020043
2014-09-03 09:03:42 -04:00
David Crawshaw 3d312b5a2b go.mobile: break dependency on gobind
Preparation for NativeActivity-based apps.

LGTM=nigeltao
R=golang-codereviews, nigeltao
CC=golang-codereviews
https://golang.org/cl/126520043
2014-09-03 09:03:00 -04:00
David Crawshaw 3bd69d3fcc go.mobile/gl: tracing debug mode
Compiling a binary with "-tags gldebug" will add log
tracing to each GL function call. This is the best I
can offer in lieu of of real error handling.

A colleague has accused me of Aspect-oriented
programming. The wikipedia article on the topic lost
me in the first paragraph, so just for the record,
this was inspired by the way the cover tool rewrites
source code.

LGTM=sameer
R=golang-codereviews, sameer
CC=golang-codereviews
https://golang.org/cl/128640043
2014-08-26 10:03:00 -04:00
David Crawshaw 0394fdc6fe go.mobile/gl: OpenGL ES 2 bindings
A new set of bindings, as none of the existing open source
ones meet all the desired criteria:

- just ES 2/3, no deprecated/wider interfaces
- no hiding of GL functions behind higher-level interfaces
- no exported use of C types
- no other library dependencies
- no exported use of unsafe.Pointer
- use Go slices for passing arrays

Function stubs were generated from the gl.xml spec file,
however there were enough special cases (and few enough
functions in the ES spec) that it was easier to construct
most of this file by hand rather than complete a generator
script. So it is not included in this CL.

LGTM=adg
R=golang-codereviews, bryanturley, adg, capnm9
CC=golang-codereviews
https://golang.org/cl/127870043
2014-08-25 08:17:08 -04:00
David Crawshaw 4b6d21f64f go.mobile/app: a little documentation
LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/128580044
2014-08-21 16:07:33 -04:00
David Crawshaw f53c6fa014 go.mobile/app: override log output
Results in faster writes to logcat as it skips the pipe.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/132800044
2014-08-21 16:06:11 -04:00
David Crawshaw cd38d7f2f1 go.mobile/cmd/gobind: newline after printing errors
LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/123210043
2014-08-12 14:29:18 -04:00
David Crawshaw d58b149990 go.mobile/cmd/gobind: use go/loader to load packages
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/127050043
2014-08-12 14:09:08 -04:00
David Crawshaw e8dea067be go.mobile/cmd/gobind: language binding command line tool
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/120140043
2014-08-01 10:45:18 -04:00
David Crawshaw 997628f863 go.mobile/example/hello: trivial language binding example
LGTM=adonovan
R=adonovan, adg
CC=golang-codereviews
https://golang.org/cl/116260043
2014-07-31 15:20:01 -04:00