Thanks a lot for the patience.
I divided my entire 4k*4k image into 4 parts and then scaling each to 256 and then using DrawPixels.
I do realize that scaling function is slow and currently it is throwing should not reach here runtimeexception
Here is the code for dat:
for(int i=0;i<4;i++)
{
File red=new File("/usr3/shefali/project/images/s1.geo");
File green=new File("/usr3/shefali/project/images/s2.geo");
File blue=new File("/usr3/shefali/project/images/s3.geo");
ImageFile file=new ImageFile(red,green,blue); //This is a class reading data from the file
file.setFileSize(new Dimension(width,height),3);
file.setSkip();
ByteBuffer originalImage=file.generateBuffer(i);
scaledImage[i]=ByteBuffer.allocate(sx*sy*3);
originalImage.flip();
System.out.println("\nScaling Quarter of an Image............");
int error=0;
try{
error=glu.gluScaleImage(GL.GL_RGB,height/2,width/2,GL.GL_UNSIGNED_BYTE,originalImage,sx,sy,GL.GL_UNSIGNED_BYTE,scaledImage[i]);
System.out.println("Image Scaled Successfully.");
}catch(Exception e){
System.out.println("Error occured while scaling image. Error Code: "+error);
e.printStackTrace();
}
originalImage=null;
freeResources();
}
stopTime=Calendar.getInstance().getTimeInMillis();
long timeDiff=stopTime-startTime;
System.out.println(“Successfully Created Quarters in: “+timeDiff+” ms…”);
setStatus(“Image Loaded”);
}
The image gets loaded successfully , with the exception thrown,but only after 30-35 seconds.
i m using a 4 processor machine wid 4g ram.
Regards,
Shefali