Login  Register

Re: method not implemented: gluScaleImage

Posted by OwenD on Jan 24, 2011; 3:12pm
URL: https://forum.jogamp.org/method-not-implemented-gluScaleImage-tp2304656p2320339.html

Thanks for the reply. Switching to GLUgl2 fixes the "method not implemented" error. However, we are seeing a new issue with gluScaleImage when the image is relatively large:

Exception in thread "main" java.lang.OutOfMemoryError
      at sun.misc.Unsafe.allocateMemory(Native Method)
      at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:102)
      at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
      at com.jogamp.opengl.impl.glu.mipmap.Type_Widget.<init>(Type_Widget.java:59)
      at com.jogamp.opengl.impl.glu.mipmap.Image.empty_image(Image.java:522)
      at com.jogamp.opengl.impl.glu.mipmap.Mipmap.gluScaleImage(Mipmap.java:588)
      at javax.media.opengl.glu.gl2.GLUgl2.gluScaleImageJava(GLUgl2.java:375)
      at javax.media.opengl.glu.gl2.GLUgl2.gluScaleImage(GLUgl2.java:510)

when called like this:

public void testGluScaleImage()
{                
    int widthin = 559;
    int heightin = 425;
    
    int widthout = 1024;
    int heightout = 512;
    
    int textureInLength = widthin * heightin * 4;
    int textureOutLength = widthout * heightout * 4;
    
    byte[] datain = new byte[textureInLength];
    byte[] dataout = new byte[textureOutLength];
    
    ByteBuffer bufferIn  = ByteBuffer.wrap(datain);
    ByteBuffer bufferOut = ByteBuffer.wrap(dataout);        
    _glu.gluScaleImage(GL.GL_RGBA, widthin, heightin, GL.GL_UNSIGNED_BYTE, bufferIn, widthout, heightout, GL.GL_UNSIGNED_BYTE, bufferOut);
}