TrueTypeFont.drawString () is not supported

I am trying to implement 2D text rendering in my LWJGL game and search everywhere for a working solution, but keep getting the same error. I am currently trying to complete this tutorial . Here is the error:

Exception in thread "main" java.lang.IllegalStateException: Function is not supported
    at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
    at org.lwjgl.opengl.GL11.glColor4f(GL11.java:893)
    at org.newdawn.slick.opengl.renderer.ImmediateModeOGLRenderer.glColor4f(ImmediateModeOGLRenderer.java:124)
    at org.newdawn.slick.Color.bind(Color.java:182)
    at org.newdawn.slick.TrueTypeFont.drawString(TrueTypeFont.java:363)
    at org.newdawn.slick.TrueTypeFont.drawString(TrueTypeFont.java:355)
    at guis.Gui.drawString(Gui.java:23)
    at engineTester.MainGameLoop.main(MainGameLoop.java:110)

and here is my Gui class:

package guis;

import java.awt.Font;

import org.newdawn.slick.TrueTypeFont;

public class Gui {

    private TrueTypeFont font;
    private Font awtFont;

    public Gui() {
        this.awtFont = new Font("Times New Roman", Font.BOLD, 24);
        this.font = new TrueTypeFont(awtFont, false);
    }

    public void drawString(int x, int y, String text) {
        font.drawString(x, y, text);
    }

}

Why is this error occurring?

EDIT: Regarding this answer to another question: qaru.site/questions/1465888 / ... I've already done it, and it does not work.

+4
source share
2 answers

opengl 3.0, , TrueTypeFont, 3.x. opengl 3.x/4.x Opengl3.3 opengl.

+1

, , , -

    public Gui theGui = new Gui();

, . , , , TrueTypeFont, OpenGL , , , , , OpenGL.

public Gui gui;, GL this.gui = new Gui();.

, . , Slick ( , , , OpenGL?) .

+1

Source: https://habr.com/ru/post/1690882/


All Articles