Good morning
I try to create a zoom function that magnifies the content of the screensection where the mouse is being dragged over and draws it in a corner.
Since I am fairly new in the Jogl world, I tried to do sth basic. I get the content with
gl.glReadPixels(0, 0, this.width, this.height, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, buffer );
(where width/height are the current width and height of the canvas) and buffer is the ByteBuffer).
Then I draw the buffer content with
gl.glWindowPos2i(0,0);
gl.glPixelZoom(0.25f, 0.25f);
gl.glDrawPixels(this.width, this.height, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, buffer);
Okay, no problem until now and I have got a small screen which shows me the content of the canvas 1:1.
But here is my problem: The GLCanvas is embedded on a JFrame with a Menu/Toolbar.
The toolbar is dragable. When I place it over the Canvas I get a
java.lang.IndexOutOfBoundsException
So from what I have read, glReadPixels can only be called on a Canvas that is in the front.
What different approach can I use to reach the same result?
Take care
randy