obtain colors of a pixel

Hello

I’m using JOGL for my application. I would like to know if it is possible to get the colors of a pixel, knowing its coordinates.
I’m using a GLCanvas constructed like this :


GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
        canvas.addGLEventListener(new Renderer());

Thank you very much for answers.

Bye bye !

You’re looking for the glReadPixels function. Although its not going to help your performance any by sticking a bubble in your rendering pipeline. And make sure you only call it in your animation thread, otherwise you’ll get horrible unpredictable results.

What’s this “bubble” thing I keep reading about? :slight_smile:

When performing a read operation the whole pipeline will be flushed, which “defeats” the use of a pipeline : you have to wait for all previous operations to be completed.

So reading data back from the gfx card should be avoided if performance is an issue.

Hi !

Thanks for answers.
But, I have difficulties to compute glReadPixels. ???
Have you got any examples (a short part of a listing) where you’re using this method ?
Thank you very much.

That’s ok guys, I’ve found it and solved it !

Bye bye ! :smiley: