Package overrungl.stb

Class STBEasyFont

java.lang.Object
overrungl.stb.STBEasyFont

public final class STBEasyFont extends Object
STBEasyFont relies on preview features of the Java platform:
Programs can only use STBEasyFont when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Easy-to-deploy, reasonably compact, extremely inefficient performance-wise, crappy-looking, ASCII-only, bitmap font for use in 3D APIs.

Intended for when you just want to get some text displaying in a 3D app as quickly as possible.

Doesn't use any textures, instead builds characters out of quads.

Sample Code

Here's sample code for old OpenGL; it's a lot more complicated to make work on modern APIs, and that's your problem.
import java.lang.foreign.Arena;
static MemorySegment buffer = Arena.ofAuto().allocate(99999);
void printString(float x, float y, String text, float r, float g, float b) {
    int numQuads = STBEasyFont.print(x, y, text, MemorySegment.NULL, buffer, (int) buffer.byteSize());
    GL10.color3f(r, g, b);
    GL11.enableClientState(GL.VERTEX_ARRAY);
    GL11.vertexPointer(2, GL.FLOAT, 16, buffer);
    GL.drawArrays(GL.QUADS, 0, numQuads * 4);
    GL11.disableClientState(GL.VERTEX_ARRAY);
}
Since:
0.1.0
Author:
squid233