Bug 1047 - jogamp.opengl.glu.mipmap.Mipmap badly parses the GL version when using Mesa OpenGL ES
Summary: jogamp.opengl.glu.mipmap.Mipmap badly parses the GL version when using Mesa O...
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: opengl (show other bugs)
Version: 2.3.0
Hardware: All all
: --- normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2014-08-17 01:07 CEST by Julien Gouesse
Modified: 2019-03-29 17:54 CET (History)
2 users (show)

See Also:
Type: DEFECT
SCM Refs:
f358c49418e95c622d50eb29f53c60dc4dbdee5b
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Gouesse 2014-08-17 01:07:33 CEST
Mipmap.closestFit() uses this code to get the OpenGL version:
Double.parseDouble( gl.glGetString( GL.GL_VERSION ).trim().substring( 0, 3 ) )

When Mesa uses OpenGL, it returns a string like this one:
2.1 Mesa 10.0.5

When Mesa uses OpenGL ES 1, it returns a string like this one:
OpenGL ES-CM 1.1 Mesa 10.0.5

When Mesa uses OpenGL ES 2, it returns a string like this one:
OpenGL ES 2.0 Mesa 10.0.5

Obviously, it doesn't work with OpenGL ES 1 and 2:
VERSION: OpenGL ES-CM 1.1 Mesa 10.0.5
Exception in thread "main" javax.media.opengl.GLException: Caught RuntimeException: java.lang.NumberFormatException: For input string: "Ope" on thread main
	at javax.media.opengl.GLException.newGLException(GLException.java:75)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1318)
	at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1138)
	at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:666)
	at jogamp.opengl.GLDrawableHelper.invoke(GLDrawableHelper.java:921)
	at jogamp.opengl.GLAutoDrawableBase.invoke(GLAutoDrawableBase.java:602)
	at com.ardor3d.framework.jogl.JoglNewtWindow.draw(JoglNewtWindow.java:212)
	at com.ardor3d.example.basic.JoglBasicExample.start(JoglBasicExample.java:91)
	at com.ardor3d.example.basic.JoglBasicExample.main(JoglBasicExample.java:70)
Caused by: java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "Ope"
	at jogamp.opengl.GLRunnableTask.run(GLRunnableTask.java:66)
	at jogamp.opengl.GLDrawableHelper.execGLRunnables(GLDrawableHelper.java:767)
	at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:673)
	at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:441)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1284)
	... 7 more
Caused by: java.lang.NumberFormatException: For input string: "Ope"
	at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1250)
	at java.lang.Double.parseDouble(Double.java:540)
	at jogamp.opengl.glu.mipmap.Mipmap.closestFit(Mipmap.java:259)
	at jogamp.opengl.glu.mipmap.Mipmap.gluBuild2DMipmaps(Mipmap.java:740)
	at javax.media.opengl.glu.gl2es1.GLUgl2es1.gluBuild2DMipmaps(GLUgl2es1.java:223)
	at com.ardor3d.scene.state.jogl.JoglTextureStateUtil.update(JoglTextureStateUtil.java:333)
	at com.ardor3d.scene.state.jogl.JoglTextureStateUtil.load(JoglTextureStateUtil.java:117)
	at com.ardor3d.scene.state.jogl.JoglTextureStateUtil.apply(JoglTextureStateUtil.java:726)
	at com.ardor3d.renderer.jogl.JoglRenderer.doApplyState(JoglRenderer.java:1833)
	at com.ardor3d.renderer.AbstractRenderer.applyState(AbstractRenderer.java:91)
	at com.ardor3d.scenegraph.Mesh.render(Mesh.java:267)
	at com.ardor3d.scenegraph.Mesh.render(Mesh.java:244)
	at com.ardor3d.renderer.jogl.JoglRenderer.draw(JoglRenderer.java:698)
	at com.ardor3d.scenegraph.Mesh.draw(Mesh.java:439)
	at com.ardor3d.renderer.queue.AbstractRenderBucket.render(AbstractRenderBucket.java:82)
	at com.ardor3d.renderer.queue.RenderQueue.renderBuckets(RenderQueue.java:132)
	at com.ardor3d.renderer.jogl.JoglRenderer.renderBuckets(JoglRenderer.java:146)
	at com.ardor3d.renderer.jogl.JoglRenderer.renderBuckets(JoglRenderer.java:139)
	at com.ardor3d.renderer.jogl.JoglRenderer.flushFrame(JoglRenderer.java:226)
	at com.ardor3d.framework.jogl.JoglCanvasRenderer.draw(JoglCanvasRenderer.java:266)
	at com.ardor3d.framework.jogl.JoglDrawerRunnable.run(JoglDrawerRunnable.java:16)
	at jogamp.opengl.GLRunnableTask.run(GLRunnableTask.java:60)
	... 11 more
Comment 1 Michael 2014-08-26 09:25:51 CEST
I cannot comment on vendors following the standards, but as for OpenGL ES:

-------------------
OpenGL ES 1.0, 1.1
-------------------

The GL_VERSION string identifies both the version number and the profile. The form of the string is "OpenGL ES-<profile> <major>.<minor>", where <profile> is either "CM" (Common) or "CL" (Common-Lite), and <major> and <minor> are integers. OpenGL ES 1.0 and OpenGL ES 1.1 will both have <major> of 1 but 0 or 1 for <minor>, respectively.

https://www.khronos.org/opengles/sdk/1.1/docs/man/glGetString.xml

-------------------
OpenGL ES 2.0
-------------------

GL_VERSION
Returns a version or release number of the form OpenGL<space>ES<space><version number><space><vendor-specific information>.

https://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glGetString.xml
(http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetString.xml)

-------------------
OpenGL ES 3.0, 3.1
-------------------

The GL_VERSION and GL_SHADING_LANGUAGE_VERSION strings begin with a version number. The version number uses one of these forms:

major_number.minor_number major_number.minor_number.release_number

Vendor-specific information may follow the version number. Its format depends on the implementation, but a space always separates the version number and the vendor-specific information.

https://www.khronos.org/opengles/sdk/docs/man3/html/glGetString.xhtml
https://www.khronos.org/opengles/sdk/docs/man31/html/glGetString.xhtml
Comment 2 Julien Gouesse 2014-08-26 10:32:28 CEST
(In reply to comment #1)
> I cannot comment on vendors following the standards, but as for OpenGL ES:
> 
> -------------------
> OpenGL ES 1.0, 1.1
> -------------------
> 
> The GL_VERSION string identifies both the version number and the profile.
> The form of the string is "OpenGL ES-<profile> <major>.<minor>", where
> <profile> is either "CM" (Common) or "CL" (Common-Lite), and <major> and
> <minor> are integers. OpenGL ES 1.0 and OpenGL ES 1.1 will both have <major>
> of 1 but 0 or 1 for <minor>, respectively.
> 
> https://www.khronos.org/opengles/sdk/1.1/docs/man/glGetString.xml
> 
> -------------------
> OpenGL ES 2.0
> -------------------
> 
> GL_VERSION
> Returns a version or release number of the form
> OpenGL<space>ES<space><version number><space><vendor-specific information>.
> 
> https://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glGetString.xml
> (http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetString.xml)
> 
> -------------------
> OpenGL ES 3.0, 3.1
> -------------------
> 
> The GL_VERSION and GL_SHADING_LANGUAGE_VERSION strings begin with a version
> number. The version number uses one of these forms:
> 
> major_number.minor_number major_number.minor_number.release_number
> 
> Vendor-specific information may follow the version number. Its format
> depends on the implementation, but a space always separates the version
> number and the vendor-specific information.
> 
> https://www.khronos.org/opengles/sdk/docs/man3/html/glGetString.xhtml
> https://www.khronos.org/opengles/sdk/docs/man31/html/glGetString.xhtml

Thank you for this clarification.

Of course GL2ES3.GL_MAJOR_VERSION and GL2ES3.GL_MINOR_VERSION cannot be used with ES 1.
Comment 3 Sven Gothel 2014-09-08 05:59:39 CEST
f358c49418e95c622d50eb29f53c60dc4dbdee5b

jogamp.opengl.glu.mipmap.Mipmap now uses already parsed GL version number 
and GL profile selection
    
Since Bug 1047 didn't provide a unit tests, this must be fine for now.