LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: gima on November 21, 2011, 22:08:41

Title: NullPointerException with GLUTessellator and Font
Post by: gima on November 21, 2011, 22:08:41
I can only say that GLUTessellator callback "public void vertex(Object vertexData) {" is being called with null vertexData. I don't believe this should be.

I've been comparing my code to so many other implementations of the exact same functionality, yet I cannot find out what I'm doing wrong, or am I doing anything wrong at all. This just ends up in a NullPointerException. I have tried other TrueType font files. Help, please <o>

Code is available here: http://pastebin.com/MCYMEmZG (http://pastebin.com/MCYMEmZG)

Usage:


text = new GLTextRenderer("fonts/elgar.ttf");
text.prepare("Test Text!");
text.render();


Program's output with the dreaded debug data of "derp:null".


derp:[D@160a26f
derp:null
java.lang.NullPointerException
at murprum.gl.text.GLTextRenderer$GLTRCallback.vertex(GLTextRenderer.java:113)
at org.lwjgl.util.glu.tessellation.GLUtessellatorImpl.callVertexOrVertexData(GLUtessellatorImpl.java:638)
at org.lwjgl.util.glu.tessellation.Render$RenderFan.render(Render.java:365)
at org.lwjgl.util.glu.tessellation.Render.RenderMaximumFaceGroup(Render.java:202)
at org.lwjgl.util.glu.tessellation.Render.__gl_renderMesh(Render.java:148)
at org.lwjgl.util.glu.tessellation.GLUtessellatorImpl.gluTessEndPolygon(GLUtessellatorImpl.java:578)
at org.lwjgl.util.glu.tessellation.GLUtessellatorImpl.gluEndPolygon(GLUtessellatorImpl.java:624)
at murprum.gl.text.GLTextRenderer.render(GLTextRenderer.java:99)
at biggu.Biggu.glInit(Biggu.java:39)
at murprum.gl.framework.GLFramework.enterFramework(GLFramework.java:63)
at biggu.Biggu.main(Biggu.java:21)


EDIT: I should also add that it prints GLU_TESS_ERROR2 100152  /* Missing gluBeginContour */, but that seems to be because GLUtessellatorImpl.gluEndPolygon() calls gluTessEndContour(), even though gluTessEndContour() call was made previously as a result of PathIterator.SEG_CLOSE, which might be a bug in itself..

It also prints GLU_OUT_OF_MEMORY 100902 error, but that might be because of the previous errors, or something deeper in the GLUtessellatorImpl itself.
Title: Re: NullPointerException with GLUTessellator and Font
Post by: jemandzehage on January 12, 2013, 20:34:46
Hi there,

i'm not sure if you are still interested in the solution, but i had the same error and i figured out, that i used gluEndPolygon() instead of gluTessEndPolygon(). The second way should work without errors.