Creating image/imageicon from canvas

Hello everyone,

I am in desparate need of help here. I suppose my question my sound simple, but i did not find any way to solve this problem.

I simply want to create an Image form my canvas, a screenshot. I want to take this image and save it to a file or display it in another window. I tried to use glreadPixels and pass the bytearray to ImageIcon(bytebuf) to create an imgage from that. I did not specify any header, but apart from that, something should have been created even if it looks messy.

I hope someone can help.
Thanks in advance,
Chris

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1080167202;start=1#1

Thread is about printing a GLCanvas, code is about saving the screenshot to disk. I am sure you can modify it to do what you want.

Thank you very much for your reply! I indeed found what i need. Following the thread and found another one under

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1080057321;start=2#2

that exactly had what i need. Without your hint, i’d shurely had not found that!

Thanks again,
best regards,
Chris