The following approach seems to work. I didn't need any inverting calculations, just set the viewport size to what the canvas size is.
Oh, you're right. You only need a regular viewport size.
But don't use the AWT ComponentListener for that. As I said, use the Canvas3D's ResizeListener through this method:
addResizeListener(ResizeListener2i listener);
By using the AWT ComponentListner you have three problems:
- It is not thread safe.
- You stick your application to JOGL_AWT.
- It is a little more coding with castings to use the AWT listener
It works for a simple test, at least. Any loopholes? Maybe this might become a built-in functionality in Xith, because it's practically always needed if you have a resizing canvas, right?
Yes, this is a good idea.
Marvin