Giter Site home page Giter Site logo

behdad / glyphy Goto Github PK

View Code? Open in Web Editor NEW
658.0 44.0 75.0 1.92 MB

GLyphy is a signed-distance-field (SDF) text renderer using OpenGL ES2 shading language.

License: Other

Shell 0.46% C 22.54% C++ 53.60% Makefile 7.94% GLSL 7.78% M4 2.60% JavaScript 0.60% Meson 4.05% Python 0.42%

glyphy's Introduction

GLyphy is a signed-distance-field (SDF) text renderer using OpenGL ES2 shading language.

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 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.

See this video for insight to how GLyphy works:

http://vimeo.com/behdad/glyphy

Dicussions happen on:

https://groups.google.com/forum/#!forum/glyphy


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.

Compilation instructions on Mac OS X

  1. Install Xcode and command line tools (as of Xcode 4.3.x, from   within Preferences -> Downloads).
  2. Install MacPorts.
  3. sudo port install automake autoconf libtool pkgconfig freetype
  4. ./autogen.sh
  5. make

Compilation instructions on Windows

See appveyor.yml, basically first get 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's People

Contributors

13rac1 avatar behdad avatar chergert avatar divanvisagie avatar ds-hwang avatar ebraminio avatar fanc999-1 avatar kant avatar khaledhosny avatar linusu avatar mmohrhard avatar tamamu avatar tatamata avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glyphy's Issues

Glyphy output doesn't look good on my embedded system

Hello,

I changed the glyphy code according to my embedded system by removing glut and glew dependency and added my own window system.
But the text doesn't look as it is shown on windows.

The output is somewhat like attached image
glyphytargettet

Please help in what I am doing wrong.

"vector subscript out of range" in demo-font.cc

Hi.Yeah,I added your fixes to demo-font.cc but now it fails several lines down after

" if (endpoints.size ())" safety statement you added.

It fails in demo-font.cc here:

   if (!glyphy_arc_list_encode_blob (&endpoints[0], endpoints.size (),
                buffer,
                buffer_len,
                faraway / SCALE,
                4, /* UNUSED */
                &avg_fetch_achieved,
                output_len,
                nominal_width,
                nominal_height,
                extents)){
die ("Failed encoding arcs");

}

with the same issue as above - endpoints[0] has size of zero.I tried to wrap it with size check as you did but in this case the program exists silently .

what should demo look like?

What should the demo look like?
I can see no discernible text in it. Just lines tightly packed together.
Is this how it /should/ look?

Mac install instructions don't work on Maverick

Another issue I encountered a couple of weeks ago trying to build the lib on Mac OS X Maverick.;

These steps:

Compilation instructions on Mac OS X:

  1. Install Xcode and command line tools (as of Xcode 4.3.x, from
    within Preferences -> Downloads).
  2. Install MacPorts.
  3. sudo port install automake autoconf libtool pkgconfig cairo freetype
  4. ./autogen.sh
  5. make

don't work.

I installed MacPorts but command (3) just doesn't work.It always complains about pkgconfig missing.

Not really using Mac but maybe you will want to revise the make script .

Current status of glyphy?

What's the current status of glyphy? It seems like with Vulkan becoming a useful API, things should be easier to deal with now.

Thanks.

GLSL to HLSL

Have you ever tried to port it to DirectX + HLSL?

I integrated it to my DX/OGL rendering engine. OGL+GLSL works just fine but DX+HLSL renders some glyphs (not all) with some artifacts.

Add configure option for --with-demo

Copying comments from the Google Code bug, just for future reference:

Reported by kcconley, Oct 30, 2012
Add support to skip demo and its dependencies during 'configure' and to not build demo when running 'make'.
Nov 1, 2012 Delete comment Project Member #1 behdad.esfahbod
Fair enough.  However, the dependencies shouldn't pose a build fail.  If you don't mind me asking, what''s the primary reason you need this?
Nov 1, 2012 Delete comment #2 kcconley
I built glyphy for iOS. I just needed to link to libglyphy. I refactored (hacked) the demo to run on iOS (without GLUT). The repo version of demo won't build because GLUT doesn't exist on iOS.

BTW. Demo runs SLOW on my iPod 3G. ~3 FPS
Nov 1, 2012 Delete comment #3 [email protected]
Interesting.  If you have patches of the changes I'd be happy to take them.
Nov 1, 2012 Delete comment #4 kcconley
I'd be happy to give it to you. But its kind of an embarassing mess right now. I just wanted to see the performance so I spent an hour or so getting it running. I have an Xcode project which is more or less a hacked version of the demo files and some platform-specific stuff. I have it linking to libglyphy which I am building from the command-line. Nothing that resembles a 'patch' at this point.
Nov 1, 2012 Delete comment #5 [email protected]
Right.  That's what I expected.  Would be interesting to see the number on iPhone 5.  I'm more interested seeing numbers on Android, and have not got the time to port yet.
Nov 1, 2012 Delete comment #6 kcconley
I will try it on the 4S this weekend. Was hoping it would be faster than it was. Its too heavy in the fragment shader. I would like to make it faster. :-/ You guys working on any major speed improvements?
Nov 1, 2012 Delete comment Project Member #7 behdad.esfahbod
I'm not actively working on it right now, but may do next year.  However, most of my ideas involve reducing texture fetches in exchange of more work in the fragment shader :(.  The thing is, I don't have a test environment that is weak on the shader operations, so I can't test any change.

On my two testing machines (ThinkPad T530, and Macbook Air), the demo runs at over 60fps fullscreen...
Nov 1, 2012 Delete comment #8 kcconley
You can simply try to render the demo geometry X times per frame. Increase X until the framerate drops to like 20 fps or something.
Dec 6, 2012 Delete comment #9 [email protected]
So, any chance you can run this on an iPhone5?

api misnomer

Glyphy has glyphy_arc_accumulator_cubic_to and glyphy_arc_accumulator_conic_to.

The cubic_to method is as expected, it creates a cubic Bézier segment.

The conic_to method however, just creates a quadratic Bézier, not a rational quadratic one, as the name would suggest.

possible bug in glyph rendering?

image

would this be a bug in the glyph rendering or in the font file?

make && ./demo/glyphy-demo -t "{" -f /System/Library/Fonts/Times.ttc

this does not seem to happen in other font files

tho some fonts render a square such as /System/Library/Fonts/Keyboard.ttf

./demo/glyphy-demo -t "1234567890-=q\`wertyuiop[]\asdfghjkl;\'zxcvbnm,./~!@#$%^&*()_+{}|:\"<>?QWERTYUIOPASDFGHJKLZXCVBNM" -f /System/Library/Fonts/Keyboard.ttf

image

Hook up Android touch events?

Might be a simple patch to libGLUT. Or maybe upstream has added already, not sure.

Making the Android demo useful will be great.

Handle cusps

Should break at cusp and convert resulting curves separately.

Demo Programm, changing text size and position

There is a way in your library to set the display coordinates to render a text at a specific position, or to set the font size directly (without scaling the projection matrix)?.
On the file glyphs-demo.cc I tried to change the coordinates of glyphy_point_t top_left for example to:
glyphy_point_t top_left = {100, 50}; demo_buffer_move_to (buffer, &top_left);
But the text is still render in the same position.
At the function demo_buffer_add_text the fourth parameter should be the font size, but f.e. if you change the size from 1 to f.e.:
demo_buffer_add_text (buffer, text, font, 100);
there is no any difference with demo_buffer_add_text (buffer, text, font, 1);
Of course if I scale the projection matrix it grows.
Is this a bug, or what is the purpose for both parameter ?

Perspective text rendering

Is it possible with glyphy to skew text so it can be placed into a 3D secene? If so, it would be a nice feature to have a skewing option in the demo.

Cheers
Ben

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.