I'm trying to implement 2D text rendering into my LWJGL game and have searched everywhere for a working solution, but keep getting the same error. I am currently trying to follow 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 caused?
EDIT: Regarding this answer to another question: https://stackoverflow.com/a/26319508/5838494 I already did this and it does not work.