Copyright © Dan Wilcox & Akira Hayasaka 2011-2023
GNU Public License v2.
For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "LICENSE.txt," in this distribution.
This is a rewrite of the GLEditor from Fluxus Copyright © 2005 Dave Griffiths
Uses:
- fontstash for text rendering
- PrintChar21 font from Kreative Software (used in examples)
See https://github.com/Akira-Hayasaka/ofxGLEditor for documentation as well as the OF forum post on ofxGLEditor
Sample Lua syntax highlighting:
ofxEditor provides a rewrite of the Fluxus live coding environment's OpenGL-based text editor for openFrameworks including simple syntax highlighting, a file browser, and a Read-Eval-Print Loop console. The ofxGLEditor provides all of the above including 9 editor buffers, so it should be easy to use this as a basis for live coding, scripting, parameter tweaking, etc. Further, ofxEditorSyntax & ofxEditorColorScheme provide simple language specific syntax highlighting.
Variable width font and full unicode glyph support (here using Arial Unicode.tff):
To use ofxGLEditor, first you need to download and install openFrameworks. Development is against the latest version of openFrameworks on Github. Checkout a tag if you need an earlier, stable version.
On macOS, you will need to install Xcode.
On Linux, you can use Makefiles and/or QT Creator project files.
On Win, you will need either Microsoft Visual Studio C++ or Msys2.
Place ofxGLEditor within a folder in the addons folder of the OF dir tree:
openframeworks/addons/ofxGLEditor
See the examples in editorSyntaxExample
, glEditorExample
, glslExample
, livecodingExample
, and the source headers in ofxGLEditor/src
.
Project files for the examples are not included so you will need to generate the project files for your operating system and development environment using the OF ProjectGenerator which is included with the openFrameworks distribution.
To (re)generate project files for an existing project:
- Click the "Import" button in the ProjectGenerator
- Navigate to the project's parent folder ie. "ofxGLEditor", select the base folder for the example project ie. "glEditorExample", and click the Open button
- Click the "Update" button
If everything went Ok, you should now be able to open the generated project and build/run the example.
This is a simple GLSL fragment (pixel) shaders editor including GLSL syntax highlighting. The shader is reloaded whenever it is saved or evaluated (MOD key + e).
This is a simple livecoding example using ofxLua including lua keyword syntax highlighting. Also, you will need to select ofxLua
from the addons list when you generate the project files for this example.
A growing set of language syntax xml files can be found in the syntaxes
folder. Additions or updates are welcome.
Both monospaced and variable width fonts are supported. PrintChar21.ttf is included with the example projects. Unicode glyphs are supported if your font has them.
Most real text editors load multiple fonts to support different language character sets. ofxGLEditor is simple, so it only loads 1 font at a time and you'll need to use an expanded character set font for multiple languages. Another option is to load a specific font for a specific language or locale in your app. Giant full character set fonts do exist (eg. Unifont), but they are generally too large to be useful as they may take a large amount of resources. Your mileage may vary.