Bug in gluBuildMipMaps

Hi

I get the following error when I try to run gluBuildMipMaps:

Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Unknown Source)
at java.nio.DirectByteBuffer.get(Unknown Source)
at net.java.games.jogl.impl.mipmap.ScaleInternal.scale_internal_ubyte(ScaleInternal.java:243)
at net.java.games.jogl.impl.mipmap.BuildMipmap.gluBuild2DMipmapLevelsCore(BuildMipmap.java:521)
at net.java.games.jogl.impl.mipmap.Mipmap.gluBuild2DMipmaps(Mipmap.java:719)
at net.java.games.jogl.impl.GLUImpl.gluBuild2DMipmapsJava(GLUImpl.java:587)
at net.java.games.jogl.impl.GLUImpl.gluBuild2DMipmaps(GLUImpl.java:823)

The same .jpg works with the old C glu implementation when running with the tag -Djogl.glu.nojava.
The .jpg is 64x126 which seems to be the problem. However I belive that glu should be able to handle
non power of 2 textures.

Is this a known bug or should I submitt it. I’m using the latest binary build?

BTW. Is there some progress in adding gamma correction to jogl ?

Cheers
// Tomas

The spec says

[quote]gluBuild1DMipmaps, gluBuild2DMipmaps, and gluBuild3DMipmaps all take an input image and derive from it a pyramid of scaled images suitable for use as mipmapped textures. The resulting textures are then passed to glTexImage1D, glTexImage2D, or glTexImage3D as appropriate. target, internalFormat, format, type, width, height, depth, and data dene the level 0 texture, and have the same meaning as the corresponding arguments to glTexImage1D, glTexImage2D, and glTexImage3D. Note that the image size does not need to be a power of 2, because the image will be automatically scaled to the nearest power of 2 size if necessary.
[/quote]
So I guess this is a bug.

It’s probably a bug, either in the original GLU sources which were ported to Java or a bug in the porting process. Could you file a bug and attach a test case? Thanks.

Submitted. I’ve attached the texture that crashed glu.