Glimpse 3.0.0 TooltipPainter throws NPE with foreground color change

14 views
Skip to first unread message

fran.m...@gmail.com

unread,
Jul 13, 2018, 12:08:28 PM7/13/18
to Glimpse
My developer team noticed a Glimpse 3.0.0 error recently.  It does not appear to be hardware/graphics driver specific.  This error does not occur with Glimpse 2.4 (which was used by the previous version of our software app).  We have determined a local fix.

We noted that while our application display has a Glimpse TooltipPainter enabled on our view, if we try to change the view's foreground color (which affects the TooltipPainter crosshair lines and text), Glimpse/JOGL throws a NullPointerException.  I've pasted the exception below.

It appears to be caused because TooltipPainter.doPaintTo() tries to call GlimpseColor.setColor() before it does the textRenderer.beginRendering()?

TooltipPainter.doPaintTo(), lines 497-498:
                GlimpseColor.setColor( textRenderer, textColor );
                textRenderer.beginRendering( width, height );

Our software application already had a need to create a local subclass of the TooltipPainter (for a font change issue-- TooltipPainter was not resizing the tooltip box after a font change?) so we just overrode the TooltipPainter.doPaintTo() in our local subclass and moved the GlimpseColor.setColor() method call a little lower, and this avoids the NPE.

------------------------------------EXCEPTION------------------------------------

Exception in thread "AWT-EventQueue-0-FPSAWTAnimator-Timer0" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: javax.media.opengl.GLException: Caught NullPointerException: null on thread AWT-EventQueue-0-FPSAWTAnimator-Timer0
at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:84)
at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:446)
at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:175)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source) Caused by: javax.media.opengl.GLException: Caught NullPointerException: null on thread AWT-EventQueue-0-FPSAWTAnimator-Timer0
at javax.media.opengl.GLException.newGLException(GLException.java:75)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1317)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1137)
at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:673)
at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:77)
... 4 more
Caused by: java.lang.NullPointerException
at com.metsci.glimpse.jogamp.opengl.util.awt.text.AbstractGlyphRenderer.setColor(AbstractGlyphRenderer.java:399)
at com.metsci.glimpse.com.jogamp.opengl.util.awt.TextRenderer$GlyphRendererProxy.beginRendering(TextRenderer.java:1032)
at com.metsci.glimpse.com.jogamp.opengl.util.awt.TextRenderer.beginRendering(TextRenderer.java:372)
at com.metsci.glimpse.com.jogamp.opengl.util.awt.TextRenderer.beginRendering(TextRenderer.java:317)
at com.metsci.glimpse.painter.info.TooltipPainter.doPaintTo(TooltipPainter.java:498)
at com.metsci.glimpse.painter.base.GlimpsePainterBase.paintTo(GlimpsePainterBase.java:183)
at com.metsci.glimpse.layout.GlimpseLayoutDelegate.paintTo(GlimpseLayoutDelegate.java:165)
at com.metsci.glimpse.layout.GlimpseLayout.paintTo(GlimpseLayout.java:462)
at com.metsci.glimpse.layout.GlimpseLayoutDelegate.paintTo(GlimpseLayoutDelegate.java:165)
at com.metsci.glimpse.layout.GlimpseLayout.paintTo(GlimpseLayout.java:462)
at com.metsci.glimpse.canvas.NewtSwingGlimpseCanvas$1.display(NewtSwingGlimpseCanvas.java:185)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:688)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:670)
at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:441)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1283)
... 7 more

Geoffrey Ulman

unread,
Jul 24, 2018, 10:31:35 AM7/24/18
to Glimpse
Thanks for the bug report. I took a look and your fix is correct. TextRender.setColor( ) definitely needs to happen after beginRendering( ) is called.
Reply all
Reply to author
Forward
0 new messages