Login  Register

GLCanvas in awt scrollpane drawing problems

Posted by Mabula Haverkamp on Jun 06, 2018; 3:00pm
URL: https://forum.jogamp.org/GLCanvas-in-awt-scrollpane-drawing-problems-tp4038912.html

Hi all,

I want to use a GLCanvas in an AWT scrollpane for an image processing application.

I understand that using a GLCanvas and awt scrollpane should give me better performance than using a GLJpanel in a JScrollpane.

In the GLcanvas, I will show an image and using the mouse wheel/buttons, users can zoom in/out on the images.

I project my data parrallel using glortho and set the viewport for the whole size of the GLCanvas.

As soon as the GLCanvas becomes bigger then the scrollpane viewport, image drawing in the GLCanvas is completely messed up.

So when the GLviewport becomes larger than the scrollpane viewport, everyhing is off, aspect ratio of the images is  clearly wrong and even depends on the aspect ratio of the scrollpane viewport it seems.

Could the problem be that the GLCanvas is partly obscured due to having it in a scrollpane? And if so, what would be the most efficient way to deal with this.

I am trying with offscreen drawing using either a offscreen gldrawable or a Frame Bufffer Object. Drawing is fine offscreen, I have tested this by saving the offscreen drawing to a BufferedImage and then to a file. That looks perfect.

As soon as I try try to render the offscreen data on the GLCanvas, I get the exact same problem unfortunately.

So my main question is this:
Could the problem be that the GLCanvas is partly obscured due to having it in a scrollpane? And if so, what would be the most efficient way to deal with this.

Kind regards,
Mabula