-
Notifications
You must be signed in to change notification settings - Fork 79
Port to Slug algorithm #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
0ca8b62
Replace arc API with quadratic Bezier curve accumulator
behdad 2d88133
Add band builder and blob encoder for Slug-style rendering
behdad bd082fb
Add Slug pixel shader (GLSL 1.30 port) and update build
behdad b6fc50d
Add demo vertex/fragment shaders and update data structures
behdad c1658ef
Wire up demo for Slug-style rendering
behdad 1a7695c
Fix demo buffer size for complex glyphs
behdad 6080bde
Fix shader compilation: require GLSL 3.30, remove stale headers
behdad 766b3ac
Remove old arc/SDF pipeline and unused files
behdad f9ab1b0
Fix missing close_path and band boundary precision
behdad 11e61e2
[meson] Adjust glut finding
behdad 9e87d56
Fix float32 precision: encode lines as (p1,p1,p3) quadratics
behdad 684c80e
Increase quantization precision to 4 units per em unit
behdad 859bf0e
Remove dead demo code for boldness, contrast, gamma, outline, debug
behdad 1803aa3
Switch atlas from 2D texture to buffer texture (TBO)
behdad 81f74e6
Move band transform into blob header, simplify client API
behdad 68b1110
Shrink per-vertex data: ivec4 -> single uint glyphLoc
behdad 3076260
Remove autotools build, add .gitignore for generated files
behdad 7888f9a
Keep extents and advance in font units, drop normalization round-trip
behdad 6440806
Share endpoints between adjacent curves in contour
behdad 1dcbbc8
Update CI: meson only, Ubuntu 24.04, drop harfbuzz build
behdad 66d32d3
Add symmetric band optimization
behdad 8eb14a3
Cleanup: remove win32 build, unused MIN_FONT_SIZE, fix CI apt
behdad 70aef1b
Per-band optimal split value for symmetric optimization
behdad 6660245
Add dynamic dilation in vertex shader
behdad 563964e
Move dilation to library vertex shader, rename shader API
behdad c99c8ed
Fix Slug attribution, remove shader _path APIs
behdad 9b136b3
Update README for Slug-based renderer, remove empty NEWS
behdad 9350673
Remove dead android build
behdad de35e77
Remove stale autotools files, update pkg-config description
behdad dca7985
Update copyright headers, remove inline Apache license text
behdad b219cc6
Require OpenGL 3.3 and guard blob int16 metadata
behdad 7437174
Make glyph dilation perspective-aware
behdad cecd89b
Require GLEW when building the demo
behdad 42d588e
Remove dead demo compatibility code
behdad 1a26351
Reuse demo glyph scratch buffer on the heap
behdad d9f9a33
Print demo controls and drop startup traces
behdad 1be1853
Add demo help shortcuts
behdad d4a1aaa
Add demo sRGB toggle shortcut
behdad e80c8ee
Log demo animation state changes
behdad 2993690
meson: link OpenGL framework for macOS demo
behdad a93b6f1
Revert "meson: link OpenGL framework for macOS demo"
behdad b6e01e5
Request sRGB window and clean up demo toggles
behdad 2ecf251
Warn about GNOME vsync overrides
behdad 9dec181
meson: use Apple GL frameworks on macOS
behdad 4dbed0a
demo: request core profile on macOS
behdad 8a25f87
demo: bind a VAO for core profile
behdad a736fd7
demo: detect sRGB framebuffer in core profile
behdad 5e23b6d
demo: port from GLUT to GLFW
behdad 2127d48
demo: fix GLEW init with core profile
behdad 1262b09
demo: fix HiDPI support with GLFW
behdad f495ada
demo: fix first-frame blurriness on Wayland HiDPI
behdad ddaa6f1
demo: fix mouse jump on first drag
behdad 8782018
demo: use double-precision timing for smooth animation
behdad b5437ed
demo: use GLFW sRGB capability hint
behdad 74b934a
demo: probe sRGB by toggling framebuffer state
behdad d3983b2
Rename demo shaders to vertex and fragment
behdad 1e13881
Abort on unsupported cubic outlines
behdad 29e6f4d
Report atlas usage in demo stats
behdad 306534d
Add bench-encode font benchmark
behdad 97d35d6
Set default Meson buildtype to debugoptimized
behdad 47239a8
Cache curve bounds during blob encoding
behdad 09ad9f2
Reduce band-list allocation churn in blob encoder
behdad 726f39a
Make band split selection linear-time
behdad 18fceba
Fold extents computation into encoder preprocessing
behdad 0c7ada9
Cache band ranges during encoder preprocessing
behdad 1ed8329
Flatten band index storage in blob encoder
behdad ea69633
Add reusable glyph encoder object
behdad 102cd52
Merge branch 'master' into slug
behdad fb65234
Add Eric to copyright holders for the Slug shaders
behdad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| build/ | ||
| *.o | ||
| *~ | ||
| .*.sw[nop] | ||
| *-glsl.h | ||
| default-font.h | ||
| default-text.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,42 @@ | ||
| GLyphy is a signed-distance-field (SDF) text renderer using OpenGL ES2 shading language. | ||
| GLyphy is a GPU text renderer that renders glyph outlines directly, | ||
| using the [Slug algorithm](https://jcgt.org/published/0006/02/02/) | ||
| by Eric Lengyel for robust winding number calculation. | ||
|
|
||
| The main difference between GLyphy and other SDF-based OpenGL renderers is that most other projects sample the SDF into a texture. This has all the usual problems that sampling has. Ie. it distorts the outline and is low quality. | ||
| GLyphy works with quadratic Bezier curves (TrueType outlines) and | ||
| produces pixel-perfect rendering at any scale with proper antialiasing. | ||
|
|
||
| GLyphy instead represents the SDF using actual vectors submitted to the GPU. This results in very high quality rendering, though at a much higher runtime cost. | ||
| ## Building | ||
|
|
||
| See this video for insight to how GLyphy works: | ||
| Requires: meson, OpenGL 3.3+, FreeType, HarfBuzz, GLUT, GLEW. | ||
|
|
||
| http://vimeo.com/behdad/glyphy | ||
| ```sh | ||
| meson setup build | ||
| meson compile -C build | ||
| build/demo/glyphy-demo | ||
| ``` | ||
|
|
||
| Dicussions happen on: | ||
| ## How it works | ||
|
|
||
| https://groups.google.com/forum/#!forum/glyphy | ||
| Each glyph's outline is encoded into a compact blob stored in a GPU | ||
| buffer texture. The fragment shader computes a winding number by | ||
| casting horizontal and vertical rays against the quadratic Bezier | ||
| curves, using Lengyel's equivalence class algorithm for numerical | ||
| robustness. Curves are organized into bands for efficient early exit. | ||
|
|
||
| ---------------------------------------------------------------------- | ||
| The vertex shader performs dynamic dilation to ensure edge pixels | ||
| are always shaded for antialiasing. | ||
|
|
||
| On GNOME3 and possibly other systems, if the vsync extension is not working (ie. pressing `v` in the demo doesn't have any effect), try running with `vblank_mode=0` env var. | ||
| Unlike Slug's reference vertex path, GLyphy computes dilation from | ||
| the projective Jacobian of NDC with respect to glyph-plane position | ||
| while using its existing quad vertex format, so the half-pixel | ||
| expansion remains perspective-aware. | ||
|
|
||
| ### Compilation instructions on Mac OS X | ||
| ## Notes | ||
|
|
||
| 1. Install Xcode and command line tools (as of Xcode 4.3.x, from | ||
| within `Preferences` -> `Downloads`). | ||
| 2. Install [MacPorts](https://www.macports.org/install.php). | ||
| 3. `sudo port install automake autoconf libtool pkgconfig freetype` | ||
| 4. `./autogen.sh` | ||
| 5. `make` | ||
| On GNOME3 and possibly other systems, if the vsync extension is not | ||
| working (pressing `v` in the demo has no effect), try running with | ||
| `vblank_mode=0`. | ||
|
|
||
| ### Compilation instructions on Windows | ||
| ## License | ||
|
|
||
| See [appveyor.yml](https://github.com/behdad/glyphy/blob/master/appveyor.yml), basically first get [vcpkg](https://github.com/Microsoft/vcpkg) and install `glew`, `freetype` and `freeglut` on it, then open win32\glyphy.sln | ||
| with Visual Studio. | ||
|
|
||
| ### Compilation instructions for emscripten | ||
|
|
||
| Assuming you have installed emscripten and have its tools on path, | ||
|
|
||
| 1. `NOCONFIGURE=1 ./autogen.sh` | ||
| 2. `CPPFLAGS='-s USE_FREETYPE=1' LDFLAGS='-s USE_FREETYPE=1' emconfigure ./configure` | ||
| 3. `make EXEEXT=.html GL_LIBS= GLUT_LIBS=` | ||
| 4. The result will be located on `demo/.libs/glyphy-demo.html` (not `demo/glyphy-demo.html`) | ||
| GLyphy is licensed under the Apache License, Version 2.0. | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.