Awesome
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.
Contribution to LEGUI
See the contribution guide for more information.
System requirements
LEGUI requires Java 8+ cause it uses lambda expressions.
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/
Also you can add your own versions of these libraries using LWJGL form.
For LEGUI and CBCHAIN dependency
https://raw.github.com/LiquidEngine/repo/releases
https://raw.github.com/LiquidEngine/repo/snapshots
For latest develop build you can use next repository:
https://raw.github.com/LiquidEngine/repo/develop
And for feature you can use feature repository:
https://raw.github.com/LiquidEngine/repo/feature
And add this dependency to your build script:
Add dependency (Maven):
<!-- LEGUI - SNAPSHOT - https://github.com/LiquidEngine/legui -->
<dependency>
<groupId>org.liquidengine</groupId>
<artifactId>legui</artifactId>
<version>${legui_version}-SNAPSHOT</version>
</dependency>
OR
<!-- LEGUI - RELEASE/DEVELOP/FEATURE - https://github.com/LiquidEngine/legui -->
<dependency>
<groupId>org.liquidengine</groupId>
<artifactId>legui</artifactId>
<version>${legui_version}</version>
</dependency>
Add dependency (Gradle):
// LEGUI - SNAPSHOT - https://github.com/LiquidEngine/legui
compile group: 'org.liquidengine', name: 'legui', version: legui_version + '-SNAPSHOT', changing: true;
// OR
// LEGUI - RELEASE/DEVELOP/FEATURE - https://github.com/LiquidEngine/legui
compile group: 'org.liquidengine', name: 'legui', version: legui_version, changing: true;
Demos:
All examples located here: LEGUI.DEMO
Projects using LEGUI:
Modeler by Cout970
<table> <tr> <td><img src="https://camo.githubusercontent.com/8dcd56ad9a0d51ae82e34dc5bf4c3c18fd9c47e1/68747470733a2f2f696d6167652e70726e747363722e636f6d2f696d6167652f7a4e424133325a6b54515f6b624a6359704c73616f412e706e67"/></td> <td><img src="https://camo.githubusercontent.com/21cc57d2dc635e2f6adf8b8f6eb06c1b48da5596/68747470733a2f2f696d6167652e70726e747363722e636f6d2f696d6167652f776336654538695f534669314b732d694e4447614a412e706e67"/></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
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.