Bug 307 - Rectangular (but still pow2) dds textures with mipmaps incorrectly loaded
Summary: Rectangular (but still pow2) dds textures with mipmaps incorrectly loaded
Status: VERIFIED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All all
: P3 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2007-07-04 09:57 CEST by Sven Gothel
Modified: 2010-03-24 07:50 CET (History)
0 users

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


Attachments

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


---- Reported by davelloyd 2007-07-04 09:57:48 ----

In the following from Texture.updateImage, the shorter of width or height will
become zero before all the mipmaps are loaded when the final mipmaps should be
(for example) 4x1, 2x1 and then 1x1:
        for (int i = 0; i < mipmapData.length; i++) {
          if (data.isDataCompressed()) {
            // Need to use glCompressedTexImage2D directly to allocate and fill
this image
            gl.glCompressedTexImage2D(texTarget, i, data.getInternalFormat(),
                                      width, height, data.getBorder(),
                                      mipmapData[i].remaining(), mipmapData[i]);
          } else {
            // Allocate texture image at this level
            gl.glTexImage2D(texTarget, i, data.getInternalFormat(),
                            width, height, data.getBorder(),
                            data.getPixelFormat(), data.getPixelType(), null);
            updateSubImageImpl(data, texTarget, i, 0, 0, 0, 0, data.getWidth(),
data.getHeight());
          }

          width /= 2;
          height /= 2;
        }
   

Suggest fix of: 
width = Math.max (width/2, 1)

etc.

I believe there are other examples of this failure mode in Texture as well.



---- Additional Comments From kbr 2007-08-06 09:27:58 ----

Sorry for the delay in addressing this bug. A fix has been checked in; if it
doesn't work, please reopen the bug and attach an image which fails to load
properly. You should be able to test this with the demos.texture.TestTexture
test in the jogl-demos workspace.




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

This bug was previously known as _bug_ 307 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=307