How can I access the picture in my canvas?

Last year this http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/ got on Slashdot and I thought it was pretty neat. (Render some random polygons, compare the result with a picture of Mona Lisa, change the polygons around a bit, if the new picture is more similar to Mona Lisa than the old one use that as the base for future changes. Repeat).

I would like to make my own, so I installed Java and JOGL on my machine and have been tweeking the JOGL-example on wikipedia. http://en.wikipedia.org/wiki/Java_OpenGL

I have come as far as to render some random polygons, but now I would like to compare what it looks like with an image file.

How do I access the canvas and get it as a bitmap or similar so I can compare it at a pixel level to my picture of Mona Lisa? A fast way is better than a slow way, I expect to do this hundreds of thousands of times to get anywhere near the original picture.

Use glReadPixels().

u can use the snapshot class if you need the whole image

glReadPixels is bogued on some graphics cards, especially some ATI FireGL.

Do you mean com.sun.opengl.util.awt.Screenshot?

yup com.sun.opengl.util.awt.Screenshot

That is so cool, just had to have a go!

Kev