Commit Graph

92 Commits

Author SHA1 Message Date
David Crawshaw 9bbfe1ee47 go.mobile/sprite/portable: fix sub-image zero bound bug in affine
Also, modify the affine test to share the test
image with the glimage test.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/164400043
2014-11-01 07:48:58 -04:00
David Crawshaw b208e914e7 go.mobile/gl/glutil: take advantage of new degree of freedom in test
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/166030043
2014-11-01 07:48:07 -04:00
Nigel Tao 970a0a0162 go.mobile/gl/glutil: let Image.Draw draw non-axis-aligned quads.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/160710043
2014-10-31 14:32:34 +11:00
David Crawshaw 0ac70a3835 go.mobile/gl/glutil, go.mobile/app/debug: create glimage with pixel size
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/165940043
2014-10-30 19:43:51 -04:00
David Crawshaw fd18e8dcec go.mobile/gl/glutil: correct image size and switch to testpattern.png
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/167910043
2014-10-30 17:30:38 -04:00
David Crawshaw 897e5be307 go.mobile/gl/glutil: use correct image bounds in translation
I have included the gl.LINEAR bugfix here as it changes the
images substantially.

Based on Nigel's excellent analysis in cl/160710043.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/168820043
2014-10-30 17:26:23 -04:00
Nigel Tao 50e85e8344 go.mobile/testdata: add a test pattern image.
LGTM=adg
R=crawshaw, adg
CC=golang-codereviews
https://golang.org/cl/162450043
2014-10-30 18:22:16 +11:00
David Crawshaw e406fcc9dd go.mobile/sprite/portable: package docs
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/162370044
2014-10-29 09:32:18 -04: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 34a31a192f go.mobile/geom: consolidate two small files into one.
Also fix a typo in "Pacakge geom".

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/159630043
2014-10-29 09:18:41 +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
Nigel Tao b3557d6b50 go.mobile/app: add comment about X11 library dependencies.
LGTM=adg, crawshaw
R=crawshaw, adg
CC=golang-codereviews
https://golang.org/cl/159530043
2014-10-28 12:07:47 +11:00
Nigel Tao ee31300452 go.mobile/f32: sin/cos look-up tables.
benchmark        old ns/op     new ns/op     delta
BenchmarkSin     98156         32725         -66.66%

LGTM=crawshaw, minux
R=crawshaw, minux
CC=golang-codereviews
https://golang.org/cl/156590043
2014-10-28 11:19:13 +11:00
Nigel Tao 3aced57cb0 go.mobile/gl/glutil: use a triangle strip instead of two triangles.
It's not a big deal in this case, but we'll probably want to do the same
for the sprite/gl package.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/163990043
2014-10-28 10:55:58 +11:00
David Crawshaw 85b2f78310 go.mobile/app: do not log info android logcat already includes
i.e. all of log.LstdFlags

LGTM=hyangah
R=golang-codereviews, hyangah
CC=golang-codereviews
https://golang.org/cl/138310043
2014-10-23 09:55:09 -04:00
David Crawshaw 479974ec25 go.mobile/app: comments from cl/147910043 and fix darwin mouse drag events
LGTM=nigeltao
R=nigeltao, hyangah
CC=golang-codereviews
https://golang.org/cl/146440043
2014-10-22 20:24:05 -04:00
Nigel Tao fab1e51609 go.mobile/geom: rename Scale to PixelsPerPt.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/160160043
2014-10-22 13:50:04 +11:00
David Crawshaw 32b64a7e1e go.mobile/app: bigger default window in x11
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/155680043
2014-10-21 22:11:11 -04:00
David Crawshaw 10d5c6ef91 go.mobile/sprite/portable: transform bugfixes and documentation
The 1/geom.Scale was simply an incorrect version of m.Inverse.
The texture scaling is to correct the fact that the pixels of
texture images were being conflated with the pxiels on the
screen. There is no inherent width/height implied by the pixel
dimensions of a texture.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/156340044
2014-10-21 08:41:44 -04:00
David Crawshaw cf4f75ce44 go.mobile/sprite: add AppendChild and RemoveChild from go.net/html
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/153680046
2014-10-19 10:49:39 -04:00
Hana Kim 80f7412a0f go.mobile: copy the local version of go.mobile instead of downloading from the net.
The purpose of this Dockerfile is to make it easier to hack on go.mobile.
'go get' is still desirable for preinstall necessary dependencies.

LGTM=crawshaw, adg
R=adg, crawshaw
CC=golang-codereviews
https://golang.org/cl/155480043
2014-10-17 13:07:55 -04:00
Hana Kim 830be8ef4c go.mobile: update Dockerfile to install hg/git/svn/bzr and freetype and go.tools/go packages.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/158970044
2014-10-15 20:11:05 -04:00
David Crawshaw 84a6a4e653 go.mobile/app: fix import path in docs
LGTM=hyangah
R=hyangah
CC=golang-codereviews
https://golang.org/cl/157040043
2014-10-15 11:18:32 -04:00
David Crawshaw 90974e3a0b go.mobile/sprite/portable: support draw.Over, document affine and invert sprite matrix
Still trying to come up with some good tests for this package.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/160880043
2014-10-15 09:44:21 -04:00
David Crawshaw c579c527c1 go.mobile/f32: add Inverse
LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/157990043
2014-10-15 09:42:53 -04:00
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