The rendering implementation is needed for using Gio UI with external
window libraries such as GLFW. Expose it in the new package gpu.
Updates #26
Signed-off-by: Elias Naur <mail@eliasnaur.com>
For integrating with external window implementations (replacing
package app), access to the event router is required. Extract it
and put it into the new package router.
Router may belong in package io/event, but can't without introducing
import cycles.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We'd like to support Gio using a different renderer binding than
the builtin. A first step is to define the Functions interface
in package gl, and extract the concrete implementations to a
separate package.
Updates #26
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This is the kind of event one gets when using 'adb shell input tap x y',
which I am trying to use for the end-to-end tests.
Right now, we only have two pointer source types: mouse and touch.
On Android, emulated touch events tend to simulate the touchscreen, not
a mouse, so let's go with that as a fallback.
Perhaps in the future we will have another special pointer source for
this kind of event, such as "unknown" or "virtual".
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Currently the golang.org/x/sys package is missing the Pipe2 call for OpenBSD.
The call exists on OpenBSD, it just isn't exposed.
This diff was tested buy adding the Pipe2 call and setting:
go mod edit -replace=golang.org/x/sys=/pat/to/modified/sys
Signed-off-by: Aaron Bieber <aaron@bolddaemon.com>
Issue #77 seems to be caused by eglGetDisplay returning a zero
EGLDisplay, yet eglGetError returns EGL_SUCCESS. Since EGLDisplay
is not necessary a pointer type, the zero value may be valid.
Updates #77
Signed-off-by: Elias Naur <mail@eliasnaur.com>
As noted in #49, GL_EXT_color_buffer_half_float is required for
GL_OES_texture_half_float to be useful for FBOs.
Updates #49
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Remove dependency on EXT_color_buffer_half_float, it's not clear it's
necessary. In any case the following FBO sanity check will catch invalid
FBO format combinations.
Updates #49
Signed-off-by: Elias Naur <mail@eliasnaur.com>
macOS supports the OpenGL core profiles where glGetString(GL_EXTENSIONS)
is not supported. Use glGetStringi(GL_EXTENSIONS, <index>) instead.
The wrong query didn't make any practical difference because Gio doesn't
need any extensions on OpenGL 3 and better.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The macOS backend uses a desktop OpenGL context, not a OpenGL ES
context. The main difference is that sRGB have to be enabled and
a vertex buffer must be bound.
Do that and fix Window.Screenshot for scenes more complex than a
glClear.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Before this change the default material were a texture, which leads
to a crash when no texture is current.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The origin of image.Images is the upper left corner. Convert the
ReadPixels result by flipping the image the y-direction.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
EGL contexts don't need locking, so their Lock and Unlock methods
are empty. Remove them and add them where necessary instead.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The policy of rendering on a separate goroutine is separate from
the actual rendering. Reflect that by introducing the RenderLoop
type for driving a GPU from a separate goroutine.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Instead of calling from the low level context into the window
for its surface and dimensions, add a Context.MakeCurrent method
that does it directly.
The result is simpler and clearer logic. For example, synchronization
is obviously no longer needed. It wasn't necessary before, but the
reason was unclear.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
For Windows:
- Add shift/ctrl/etc modifiers to mouse events, so you can recognize the
difference between "click" and "shift-click".
- Add several allowed punctuation characters as single key events, so
you can (for example) use "." as a hotkey.
Signed-off-by: Larry Clapp <larry@theclapp.org>
RegisterFragment creates an instance of a Java class and registers
it as a Fragment in the window's Context.
Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
Allows things like "ctrl-{" and ".".
All punctuation is returned as-is, e.g. "!" is "!", not "shift-1", and
"{" is "{", not "shift-[".
Also add the Enter key as a known key (fn-return on my Mac).
Signed-off-by: Larry Clapp <larry@theclapp.org>