Commit graph

12 commits

Author SHA1 Message Date
Simon Hausmann
4f5d491bf7 Minor cleanup
Remove GL context parameters from texture functions that aren't needed.
2020-09-15 09:02:34 +02:00
Simon Hausmann
570e51eaa9 Improve API of color handling of text
Make the text color a rendering variable, so that it can be passed
through as uniform to the glyph shader and applied to the gray
map of the glyphs. This avoids re-creating the glyph runs when
merely the color changes.

This already "worked" for the glyph cache based text rendering,
but it wasn't used because of the wasm canvas code path. This
patch changes that to render the text into a text using simply black
and then render that texture using our existing glyph shader,
which merely uses the alpha channel anyway.

This reduces also #cfg's.
2020-09-02 11:48:41 +02:00
Simon Hausmann
07fa020e81 Fix flickering in gallery example when pressing spin box buttons
The path shader uses only one attribute array, while the others use two.
First rendering with say the glyph shader and then the path one may leave
odd artifacts around with GLES, which is fixed by properly disabling the
vertex attribute arrays after use.

Closes: #17
2020-08-28 17:49:45 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
6faf7439c2 Delete GL shader programs automatically
We already keep the context in an RC, might as well keep another copy :-)

This re-applies commit 9b0dfa14b5 but
replaces the Clone trait on Shader, which would lead to duplicate and
too early program deletion, with an Rc<Shader>.
2020-08-10 11:20:58 +02:00
Simon Hausmann
d9c776eb57 Revert "Delete GL shader programs automatically"
This reverts commit 9b0dfa14b5 as there's
an issue with webgl and everything disappearing.
2020-08-10 09:50:04 +02:00
Simon Hausmann
9b0dfa14b5 Delete GL shader programs automatically
We already keep the context in an RC, might as well keep another copy :-)
2020-08-08 13:31:37 +02:00
Simon Hausmann
fb2b12c28a Implement basic text rendering on the wasm port
Based on Olivier's suggestion, the text rendering primitive is created
by painting the text onto a temporary HTML canvas
element and binding that to a texture.
2020-06-08 17:00:59 +02:00
Simon Hausmann
aea81f5202 Upgrade glow to a patched version
The GL bindings were missing one feature on the web side, the ability to
set texture image data from an HTML canvas element.
We're going to need that soon.

The bump to a newer version also came with some odd (but sensible)
source incompatibilities.
2020-06-08 16:57:58 +02:00
Simon Hausmann
994d47a529 Shader module cleanup
Move the specific shaders into the shaders module and then hide the Shader
type. It's not necessary to export it anymore.
2020-05-20 13:27:07 +02:00
Simon Hausmann
4834de04f9 Shader code cleanup
Move the shader code into a separate file
2020-05-20 10:50:49 +02:00