Awesome
LEGUI
Community and Support
You can join the community in the Discord server! I also encourage everyone to voice your suggestions, comments, and questions in the Discord.
If you'd like to help support and sustain this library, please consider becoming a donor!
<a href='https://ko-fi.com/J3J4L9ASJ' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
TOC
- LEGUI - What is it?
- Contribution to LEGUI
- System requirements
- OpenGL state touched by the backend
- Usage
- Projects using LEGUI
- Links
LEGUI - What is it?
GUI implementation for using with LWJGL3.
This gui library made for using with OpenGL port (LWJGL) to allow programmers fast and easy
integrate user interface to their OpenGL apps written in Java or Kotlin.
API is close to Swing API.
Examples
<table> <tr> <td>Radio button and text input</td> <td>Widgets</td> <td>TextArea</td> </tr> <tr> <td align="center"><img src="https://i.imgur.com/NMP2jll.gif" /></td> <td align="center"><img src="https://i.imgur.com/8iL2xPd.gif" /></td> <td align="center"><img src="https://i.imgur.com/WQxSN6n.gif" /></td> </tr> <tr> <td>Button, togglebutton, checkbox, selectbox</td> <td>Sliders</td> <td>ScrollPanel</td> </tr> <tr> <td align="center"><img src="https://i.imgur.com/kuTOdAk.gif" /></td> <td align="center"><img src="https://i.imgur.com/Te70Ek9.gif" /></td> <td align="center"><img src="https://i.imgur.com/RGuIpZ0.gif" /></td> </tr> </table>Contribution to LEGUI
See the contribution guide for more information.
System requirements
LEGUI requires Java 11+.
OpenGL state touched by the backend
Default renderer made on top of NanoVG which touches following states:
When textures are uploaded or updated, the following pixel store is set to
defaults: GL_UNPACK_ALIGNMENT
, GL_UNPACK_ROW_LENGTH
, GL_UNPACK_SKIP_PIXELS
, GL_UNPACK_SKIP_ROWS
. Texture binding is also affected. Texture updates can happen when the user
loads images, or when new font glyphs are added. Glyphs are added as needed start and end
of render()
method.
The data for the whole frame is buffered and flushed in end of rendering. The following code illustrates the OpenGL state touched by the rendering code:
glUseProgram(prog);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glStencilMask(0xffffffff);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glStencilFunc(GL_ALWAYS, 0, 0xffffffff);
glActiveTexture(GL_TEXTURE0);
glBindBuffer(GL_UNIFORM_BUFFER, buf);
glBindVertexArray(arr);
glBindBuffer(GL_ARRAY_BUFFER, buf);
glBindTexture(GL_TEXTURE_2D, tex);
glUniformBlockBinding(... , GLNVG_FRAG_BINDING);
Usage
Dependencies
Add dependency repo
For using this library you should add these urls as repositories:
For LWJGL and JOML
dependencies
https://oss.sonatype.org/content/repositories/snapshots/
- for snapshots
https://oss.sonatype.org/content/repositories/releases/
- for releases
Also you can add your own versions of these libraries
using LWJGL form.
For LEGUI and CBCHAIN dependency
https://raw.github.com/SpinyOwl/repo/releases
And add this dependency to your build script:
Add dependency (Maven):
<!-- LEGUI - https://github.com/SpinyOwl/legui -->
<dependency>
<groupId>com.spinyowl</groupId>
<artifactId>legui</artifactId>
<version>${legui_version}</version>
</dependency>
Add dependency (Gradle):
// LEGUI - https://github.com/SpinyOwl/legui
compile group: 'com.spinyowl', name: 'legui', version: "${legui_version}";
Demos:
All examples located under demo package.
Projects using LEGUI:
Modeler by Cout970
<table> <tr> <td><img src="https://i.imgur.com/BWWotpp.png" alt="3d view"/></td> <td><img src="https://i.imgur.com/5HfHfy4.png" alt="texture editing"/></td> </tr> </table>Open 3D Modeling Tool (Cout970/Modeler)
This tool is written in Kotlin, using LWJGL3 for rendering and Legui to build user interfaces
FMT by Fexcraft
<table> <tr> <td><img src="http://fexcraft.net/files/app_data/fmt-page/javaw_2020-05-02_17-34-09.png"/></td> <td><img src="http://fexcraft.net/files/app_data/fmt-page/javaw_2020-05-02_17-35-10.png"/></td> </tr> </table>Fex's Modelling Toolbox (Fexcraft/FMT)
A Tool to create Models basing on the "TMT" (updated and maintained version of Fex/FCL) Library.
Links
LWJGL - Lightweight Java Game Library 3
JOML – Java OpenGL Math Library
CBCHAIN - Callback Chain for LWJGL3
NanoVG -Small antialiased vector graphics rendering library for OpenGL.