Skip to content
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

OpenGL 3 implementation of glfontstash.h #23

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,29 @@ $ make
$ ./example
```

# OpenGL 3+ support

When using font stash with OpenGL 3 you run into problems due to OGLs switch to using vertex arrays, vertex buffers and removal of the fixed rendering pipeline.
Simply include gl3fontstash.h instead of glfontstash.h to use the OpenGL 3 render additions.

Note that this requires an extension manager to be used such as [GLEW](http://glew.sourceforge.net/) and that a new function called gl3fonsProjection must be called before rendering text.

``` c
GLfloat mat[16];

memset(mat, 0, 16 * sizeof(GLfloat));
mat[0] = 2.0 / screenwidth;
mat[5] = -2.0 / screenheight;
mat[10] = 2.0;
mat[12] = -1.0;
mat[13] = 1.0;
mat[14] = -1.0;
mat[15] = 1.0;

gl3fonsProjection(mFS, mat);

```

# License
The library is licensed under [zlib license](LICENSE.txt)

Expand Down
Loading