<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>1047</bug_id>
          
          <creation_ts>2014-08-17 01:07:33 +0200</creation_ts>
          <short_desc>jogamp.opengl.glu.mipmap.Mipmap badly parses the GL version when using Mesa OpenGL ES</short_desc>
          <delta_ts>2019-03-29 17:54:46 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>opengl</component>
          <version>2.3.0</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Julien Gouesse">gouessej</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>gouessej</cc>
    
    <cc>michael.esemplare</cc>
          
          <cf_type>DEFECT</cf_type>
          <cf_scm_refs>f358c49418e95c622d50eb29f53c60dc4dbdee5b</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>4107</commentid>
    <comment_count>0</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2014-08-17 01:07:33 +0200</bug_when>
    <thetext>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&apos;t work with OpenGL ES 1 and 2:
VERSION: OpenGL ES-CM 1.1 Mesa 10.0.5
Exception in thread &quot;main&quot; javax.media.opengl.GLException: Caught RuntimeException: java.lang.NumberFormatException: For input string: &quot;Ope&quot; 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: &quot;Ope&quot;
	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: &quot;Ope&quot;
	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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4123</commentid>
    <comment_count>1</comment_count>
    <who name="Michael">michael.esemplare</who>
    <bug_when>2014-08-26 09:25:51 +0200</bug_when>
    <thetext>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 &quot;OpenGL ES-&lt;profile&gt; &lt;major&gt;.&lt;minor&gt;&quot;, where &lt;profile&gt; is either &quot;CM&quot; (Common) or &quot;CL&quot; (Common-Lite), and &lt;major&gt; and &lt;minor&gt; are integers. OpenGL ES 1.0 and OpenGL ES 1.1 will both have &lt;major&gt; of 1 but 0 or 1 for &lt;minor&gt;, 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&lt;space&gt;ES&lt;space&gt;&lt;version number&gt;&lt;space&gt;&lt;vendor-specific information&gt;.

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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4124</commentid>
    <comment_count>2</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2014-08-26 10:32:28 +0200</bug_when>
    <thetext>(In reply to comment #1)
&gt; I cannot comment on vendors following the standards, but as for OpenGL ES:
&gt; 
&gt; -------------------
&gt; OpenGL ES 1.0, 1.1
&gt; -------------------
&gt; 
&gt; The GL_VERSION string identifies both the version number and the profile.
&gt; The form of the string is &quot;OpenGL ES-&lt;profile&gt; &lt;major&gt;.&lt;minor&gt;&quot;, where
&gt; &lt;profile&gt; is either &quot;CM&quot; (Common) or &quot;CL&quot; (Common-Lite), and &lt;major&gt; and
&gt; &lt;minor&gt; are integers. OpenGL ES 1.0 and OpenGL ES 1.1 will both have &lt;major&gt;
&gt; of 1 but 0 or 1 for &lt;minor&gt;, respectively.
&gt; 
&gt; https://www.khronos.org/opengles/sdk/1.1/docs/man/glGetString.xml
&gt; 
&gt; -------------------
&gt; OpenGL ES 2.0
&gt; -------------------
&gt; 
&gt; GL_VERSION
&gt; Returns a version or release number of the form
&gt; OpenGL&lt;space&gt;ES&lt;space&gt;&lt;version number&gt;&lt;space&gt;&lt;vendor-specific information&gt;.
&gt; 
&gt; https://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glGetString.xml
&gt; (http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetString.xml)
&gt; 
&gt; -------------------
&gt; OpenGL ES 3.0, 3.1
&gt; -------------------
&gt; 
&gt; The GL_VERSION and GL_SHADING_LANGUAGE_VERSION strings begin with a version
&gt; number. The version number uses one of these forms:
&gt; 
&gt; major_number.minor_number major_number.minor_number.release_number
&gt; 
&gt; Vendor-specific information may follow the version number. Its format
&gt; depends on the implementation, but a space always separates the version
&gt; number and the vendor-specific information.
&gt; 
&gt; https://www.khronos.org/opengles/sdk/docs/man3/html/glGetString.xhtml
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4201</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2014-09-08 05:59:39 +0200</bug_when>
    <thetext>f358c49418e95c622d50eb29f53c60dc4dbdee5b

jogamp.opengl.glu.mipmap.Mipmap now uses already parsed GL version number 
and GL profile selection
    
Since Bug 1047 didn&apos;t provide a unit tests, this must be fine for now.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>