How to make AWT GLCanvas stop drawing everything at bottom left of parent window

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to make AWT GLCanvas stop drawing everything at bottom left of parent window

jedwards1211
In my program, I have an AWT GLCanvas whose bottom left corner is above/to the right of the bottom left corner of its window ancestor.

Nevertheless, it draws over components to the left of and below it all the way to the left and bottom edges of the window.  Even if I change the glViewport coordinates or use a framebuffer and change the coordinates I blit to, it does this.

I can't see how anything other than the bottom left corner of the GLCanvas being the 0, 0 point of the OpenGL context's screen coordinates would be the expected behavior.

How can I make it not draw over the left/bottom portions of the window contents?
Reply | Threaded
Open this post in threaded view
|

Re: How to make AWT GLCanvas stop drawing everything at bottom left of parent window

jedwards1211
Perhaps I should just go with a GLWindow inside a NewtCanvasAWT?
Reply | Threaded
Open this post in threaded view
|

Re: How to make AWT GLCanvas stop drawing everything at bottom left of parent window

jedwards1211
In reply to this post by jedwards1211
So I can offset the left/bottom sides of a NewtCanvasAWT by putting it inside an AWT container with insets.

Yet the left/bottom of the NewtCanvasAWT relative to the window don't affect where it gets drawn, only the insets of its parent do.

Furthermore, if its parent's insets change later, its position doesn't change.

I smell a hack.
Reply | Threaded
Open this post in threaded view
|

Re: How to make AWT GLCanvas stop drawing everything at bottom left of parent window

jedwards1211
I don't get it, I can't reproduce these issues in a minimal from-scratch project.  What could I be doing wrong?  I made a timer print out the bounds of the of the canvas, and they don't match where openGL is drawing on screen.  I'm doing glViewport in exactly the same way.
Reply | Threaded
Open this post in threaded view
|

Re: How to make AWT GLCanvas stop drawing everything at bottom left of parent window

jedwards1211
Argh...the problem appears to be that the GLCanvas/NewtCanvasAWT were created on the EDT.  When they were created on the system main thread, I couldn't reproduce the problem.

Swing components are generally supposed to be created on the EDT, so this is a bug.  I'll file a report later...
Reply | Threaded
Open this post in threaded view
|

Re: How to make AWT GLCanvas stop drawing everything at bottom left of parent window

jedwards1211
Actually, that wasn't correct.  The JFrame containing the GLCanvas or NewtCanvasAWT merely needs to be setVisible on the EDT (i.e. AWT event dispatch thread) for the bug to occur; if it's set visible on the main thread then the bug doesn't occur.
Reply | Threaded
Open this post in threaded view
|

Re: How to make AWT GLCanvas stop drawing everything at bottom left of parent window

gouessej
Administrator
Hi

Can you provide a simple test case to reproduce this bug?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to make AWT GLCanvas stop drawing everything at bottom left of parent window

jedwards1211
Yes, almost done with it :)
Reply | Threaded
Open this post in threaded view
|

Re: How to make AWT GLCanvas stop drawing everything at bottom left of parent window

jedwards1211
In reply to this post by gouessej
Okay, here's the bug with a link to a git repo with the repro code:

https://jogamp.org/bugzilla/show_bug.cgi?id=1277