The error message is not appropriate where there are multiple backends,
and there's a much better chance Gio will run with the direct3d backend
where no external DLLs are required.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The srgb package was recently created to contain just the sRGB
emulation, but the names weren't shortened accordingly.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
To prepare package headless for multiple backends, refactor the common headless
driver to no longer assume an OpenGL context. Instead, introduce a headless
backend type and the OpenGL implementation, glBackend.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This is a refactoring change to prepare for another gpu.Backend
implementations.
Notably, app/loop.go no longer imports gpu/gl.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
A recent change made the OpenGL functions an interface of the functions
required for the implementation of GPU, a renderer for Gio operations.
That allowed for running Gio on external systems where OpenGL is
available.
However, to allow for non-OpenGL flavored backends such as Vulkan,
Metal and Direct3D, this change introduces Backend for the high-level
operations required by GPU. This change also adds a concrete backend
to package gl.
Type Backend is a first cut heavily based on OpenGL. Future changes will add
more backends, where the Backend interface quite possibly will need refinement.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
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>