Note that there are some explanatory texts on larger screens.

plurals
  1. POLWJGL 3.2.0+ fonts
    text
    copied!<p>I've been working with lwjgl for some time, and recently I've decided to switch from fixed function pipeline to shaders. So, the first thing when I'm starting my program, I set the ContextAttrib(3, 2) so I will be using GL 3.2+. The problem is that when I switch on higher version of GL a lot of functions become unsupported. Before switching to higher GL, I've used Slick's font (TrueTypeFont) to render the text I needed, but now the drawString method of TrueTypeFont has an unsupported function within itself. I've tried to google for solution, but nothing came up.</p> <p>Does anyone know if it is possible to render text with slick-util library, while using GL version 3.2+ or with some other library? Or any link on the topic. I would appreciate any help, or suggestion.</p> <p>EDIT: The code for starting openGL 3.2 and newer form the tutorial on the wiki</p> <pre><code>try { PixelFormat pixelFormat = new PixelFormat(); ContextAttribs contextAtrributes = new ContextAttribs(3, 2) .withForwardCompatible(true) .withProfileCore(true); Display.create(pixelFormat, contextAtrributes); } catch (LWJGLException e){ e.printStackTrace(); return; } </code></pre> <p>By using openGL 3.2 or newer you are forced to use only shaders. The exception appearing when calling drawString on UnicodeFont or TrueTypeFont, or any other fixed function pipeline function like GL11.glMatrixMode(GL11.GL_PROJECTION);:</p> <pre><code>Exception in thread "Thread-0" java.lang.IllegalStateException: Function is not supported at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58) at org.lwjgl.opengl.GL11.glColor4f(GL11.java:881) at org.newdawn.slick.opengl.renderer.ImmediateModeOGLRenderer.glColor4f(ImmediateModeOGLRenderer.java:127) at org.newdawn.slick.Color.bind(Color.java:182) at org.newdawn.slick.UnicodeFont.drawDisplayList(UnicodeFont.java:443) at org.newdawn.slick.UnicodeFont.drawString(UnicodeFont.java:551) at org.newdawn.slick.UnicodeFont.drawString(UnicodeFont.java:559) at org.newdawn.slick.UnicodeFont.drawString(UnicodeFont.java:555) at application.Controller.render3D(Controller.java:163) at Engine.Engine.renderScene3D(Engine.java:230) at Engine.Engine.render(Engine.java:334) at Engine.Engine.gameLoop(Engine.java:306) at Engine.Engine.access$1(Engine.java:246) at Engine.Engine$1.run(Engine.java:154) </code></pre> <p>thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload