Bug 365 - Bug on javax.media.opengl.glu.GLU.gluBuild2DMipmaps
Summary: Bug on javax.media.opengl.glu.GLU.gluBuild2DMipmaps
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: util (show other bugs)
Version: 1
Hardware: All windows
: P3 normal
Assignee: Michael
URL:
Depends on:
Blocks:
 
Reported: 2008-12-09 12:33 CET by Sven Gothel
Modified: 2013-10-13 00:08 CEST (History)
3 users (show)

See Also:
Type: DEFECT
SCM Refs:
ed53220b4faccfd184b212bb89a075bfa53ea886 74c5332456c6faf48c0a81809969d54e056f346c
Workaround: ---


Attachments
Test case (724 bytes, text/plain)
2008-12-09 12:34 CET, Sven Gothel
Details
Test image (75 bytes, image/png)
2008-12-09 12:36 CET, Sven Gothel
Details
Here is my patch to fix this bug (99.42 KB, text/plain)
2009-04-13 13:58 CEST, Sven Gothel
Details
Updated testcase for Jogl 2.0 (2.04 KB, text/x-java-source)
2013-05-04 08:35 CEST, Michael
Details
TestCase for ScaleInternal Problem (8.34 KB, text/x-java)
2013-10-07 09:25 CEST, Michael
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2010-03-24 07:51:37 CET


---- Reported by brainbr 2008-12-09 12:33:21 ----

Exception in thread "main" java.nio.BufferUnderflowException
	at java.nio.Buffer.nextGetIndex(Buffer.java:474)
	at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:117)
	at
com.sun.opengl.impl.mipmap.ScaleInternal.scale_internal_ubyte(ScaleInternal.java:253)
	at
com.sun.opengl.impl.mipmap.BuildMipmap.gluBuild2DMipmapLevelsCore(BuildMipmap.java:535)
	at com.sun.opengl.impl.mipmap.Mipmap.gluBuild2DMipmaps(Mipmap.java:762)
	at javax.media.opengl.glu.GLU.gluBuild2DMipmapsJava(GLU.java:1526)
	at javax.media.opengl.glu.GLU.gluBuild2DMipmaps(GLU.java:1582)
	at com.sun.opengl.util.texture.Texture.updateImage(Texture.java:523)
	at com.sun.opengl.util.texture.Texture.updateImage(Texture.java:381)
	at com.sun.opengl.util.texture.Texture.<init>(Texture.java:182)
	at com.sun.opengl.util.texture.TextureIO.newTexture(TextureIO.java:445)
	at com.sun.opengl.util.texture.TextureIO.newTexture(TextureIO.java:465)
	at Mipmap.main(Mipmap.java:24)



---- Additional Comments From brainbr 2008-12-09 12:34:24 ----

Created an attachment
Test case




---- Additional Comments From brainbr 2008-12-09 12:36:02 ----

Created an attachment
Test image




---- Additional Comments From brainbr 2009-04-13 13:58:26 ----

Created an attachment
Here is my patch to fix this bug




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:51 EDT  ---

This bug was previously known as _bug_ 365 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=365
Imported an attachment (id=135)
Imported an attachment (id=136)
Imported an attachment (id=137)

The original submitter of attachment 135 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.
The original submitter of attachment 136 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.
The original submitter of attachment 137 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.

Comment 1 Julien Gouesse 2013-03-28 12:19:49 CET
I think this bug has already been fixed in JOGL 2.0. Someone should test again with the provided image.
Comment 2 Michael 2013-05-04 08:35:56 CEST
Created attachment 459 [details]
Updated testcase for Jogl 2.0

Tested against jogl2.0-rc11 on Windows. Same result:

java.nio.BufferUnderflowException
	at java.nio.Buffer.nextGetIndex(Buffer.java:472)
	at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:219)
	at jogamp.opengl.glu.mipmap.ScaleInternal.scale_internal_ubyte(ScaleInternal.java:255)
	at jogamp.opengl.glu.mipmap.BuildMipmap.gluBuild2DMipmapLevelsCore(BuildMipmap.java:538)
	at jogamp.opengl.glu.mipmap.Mipmap.gluBuild2DMipmaps(Mipmap.java:773)
	at javax.media.opengl.glu.gl2.GLUgl2.gluBuild2DMipmapsJava(GLUgl2.java:442)
	at javax.media.opengl.glu.gl2.GLUgl2.gluBuild2DMipmaps(GLUgl2.java:498)
	at com.jogamp.opengl.util.texture.Texture.updateImage(Texture.java:583)
	at com.jogamp.opengl.util.texture.Texture.updateImage(Texture.java:417)
	at com.jogamp.opengl.util.texture.Texture.<init>(Texture.java:182)
	at com.jogamp.opengl.util.texture.TextureIO.newTexture(TextureIO.java:447)
	at com.jogamp.opengl.util.texture.TextureIO.newTexture(TextureIO.java:530)
	at com.kablab.jogl.test.Mipmap$1.init(Mipmap.java:42)
	at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:332)
	at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:352)
	at javax.media.opengl.awt.GLCanvas$6.run(GLCanvas.java:966)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:653)
	at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:594)
	at javax.media.opengl.awt.GLCanvas$8.run(GLCanvas.java:996)
	at javax.media.opengl.Threading.invoke(Threading.java:193)
	at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:449)
	at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:499)
	at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
	at sun.awt.RepaintArea.paint(RepaintArea.java:224)
	at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:308)
	at java.awt.Component.dispatchEventImpl(Component.java:4729)
	at java.awt.Component.dispatchEvent(Component.java:4481)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:648)
	at java.awt.EventQueue.access$000(EventQueue.java:84)
	at java.awt.EventQueue$1.run(EventQueue.java:607)
	at java.awt.EventQueue$1.run(EventQueue.java:605)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:621)
	at java.awt.EventQueue$2.run(EventQueue.java:619)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Comment 3 Sven Gothel 2013-06-16 15:29:56 CEST
(In reply to comment #2)
> Created attachment 459 [details]
> Updated testcase for Jogl 2.0
> 
> Tested against jogl2.0-rc11 on Windows. Same result:
> 

Michael (== Mike on IRC?),
as I was asked on IRC: 
 (09:03:07 AM) [Mike]: sgothel: is there something you didn't like about the patch in https://jogamp.org/bugzilla/show_bug.cgi?id=365 ?
(09:05:52 AM) [Mike]: talk about a confusing class to walk through at first...

Yes, attachment 137 [details] is not a patch and it seems that the maintainer of the patch is n/a.

I see your test in attachment 459 [details], and I assume 'you know what you are doing and testing'
in general. So if I could ask you to make your test a true jog unit test
and add another case which would pass w/o this patch (positive / negative).

Then it would be great to make attachment 137 [details] a real unified patch,
best: unified diff incl. your unit tests. Even better git pull.

The git stuff is not that important, but whats important is one who is able to validate the change.

Hence I take the freedom and make you the maintainer of this bug, 
and I will merge your changes w/ above quality constraints.

Thank you.
Comment 4 Michael 2013-10-07 09:25:37 CEST
Created attachment 508 [details]
TestCase for ScaleInternal Problem

This test case run's through most of the ScaleInternal functions for a single column image.
Comment 5 Sven Gothel 2013-10-13 00:08:15 CEST
Thank you Michael, merged your last pull request and
add your unit test manually (you are author).

I close this bug now - if this is not correct, pls re-open. 

Thank you!