Bug 265

Summary: problem scaling TYPE_INT_ARGB, Alpha not scaling
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED INVALID    
Severity: normal    
Priority: P3    
Version: 1   
Hardware: All   
OS: windows   
URL: http://www.kyrondevelopment.com/viewer/JoglScaler.java
Type: DEFECT SCM Refs:
Workaround: ---

Description Sven Gothel 2010-03-24 07:49:55 CET


---- Reported by krazykatz 2007-01-23 14:52:57 ----

The following code doesn't work on one of the laptops in our office.  The 
same problem is showing up on a workstation at one of our site's.  It is fine
on 6-8 other computers I've tried it on.  The laptop has Window's XP and a
"GeForce Go 7900 GS" card.

All the code is trying to do is scale a 2D image.  Scaling greyscale works fine,
but when scaling TYPE_INT_ARGB all transparency is lost.  For the complete
source for the class check out the URL
http://www.kyrondevelopment.com/viewer/JoglScaler.java


      // Prepare a texture w/ source
      gl.glTexSubImage2D(
         GL.GL_TEXTURE_2D,
         0,
         0,
         0,
         m_src_width,
         m_src_height,
         GL.GL_RGBA,
         GL.GL_UNSIGNED_BYTE,
         src_ints );

      // Map the source texture to a quad
      gl.glBegin( GL.GL_QUADS );
        gl.glTexCoord2d( 0.0, 0.0 );
        gl.glVertex2f( 0.f, 0.f );

        gl.glTexCoord2d( 0.0, m_dst_height/m_scaley/PBUFFER_HEIGHT );
        gl.glVertex2f( 0.f, m_dst_height );

        gl.glTexCoord2d( m_dst_width/m_scalex/PBUFFER_WIDTH,
              m_dst_height/m_scaley/PBUFFER_HEIGHT );
        gl.glVertex2f( m_dst_width, m_dst_height );

        gl.glTexCoord2d( m_dst_width/m_scalex/PBUFFER_WIDTH, 0.0 );
        gl.glVertex2f( m_dst_width, 0.f );
      gl.glEnd();

      gl.glFlush();

      // Retrieve the scaled data
      IntBuffer scaled_buffer = BufferUtil.newIntBuffer(PBUFFER_SIZE);
      gl.glReadPixels(
            0,
            0,
            m_dst_width,
            m_dst_height,
            GL.GL_RGBA,
            GL.GL_UNSIGNED_INT_8_8_8_8_REV,
            scaled_buffer );

      int[] dst_ints = ((DataBufferInt)m_dst.getRaster().getDataBuffer()).
            getData();



---- Additional Comments From kbr 2007-01-23 15:00:18 ----

I suspect you need to call setAlphaBits(8) on the GLCapabilities you use to
create your GLPbuffer. If this doesn't solve the problem then please provide a
complete and self-contained test case showing the issue. I'll leave this bug
open for another day or two, but I don't believe this is a JOGL bug.





---- Additional Comments From krazykatz 2007-01-24 07:43:20 ----

Thank you that seems to be it.



---- Additional Comments From kbr 2007-01-24 08:49:47 ----

Not a JOGL bug.




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

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