"not drawing what is outside the viewport is the expected behaviour, it's not a bug. "
I understand this, but I would still expect the drawing inside the scollpane viewport to have correct size and aspect ratio if the glviewport is larger than the scrollpane viewport. It seems that opengl internally does something with the glviewport and so it gets distorted. But I am completely guessing here.
Thank you for the reference, highly appreciated ;-) I will give it a good read.
Yes, I haven't been entirely clear.
I am drawing the images to a 2D texture with mipmapping and then rendering the texture as a quad to the glviewport using orthographic projection with glortho. The same code for redering the image texture works perfectly offscreen using either a offscreen auto drawable or a Frame Buffer Object. But if I want to render it to the canvas which is partly obscured, all goes wrong. If I adjust the aspect ratio of the scrollpane viewport, the aspect ratio of the visble drawing changes as well, really strange. Therefore I can only conclude that openGL internally won't handle this proberly. And I probably shouldn't try drawing to pixels that can't be seen actually, after having read more documentation.
I'll try to create a SSCCE if you want to see this. Do you think it's helpfull or would you agree my problem is probably due to trying to do something that will simply not work?
Since the scrollpane solution is giving me so much trouble with openGL drawing, I have now gone the route that you suggested by skipping a real scrollpane and only drawing inside the NETWCanvasAWT. It actually is the smarter way it seems. Zooming is already working perfectly as well.
My application users want to zoom in very strongly on their images to study details on pixelbasis. With the scrollpane setup, I needed to draw a huge Canvas/Panel inside the scrollpane then, which wasn't very nice performance wise. Now, by zooming in strongly, performance is awesome as well.
I used to draw all image data using Java 2D which gave all sorts of problems and had much less performance obviously. So I am very happy with Jogl to enable OpenGL drawing in my application.