How to stop drawing outside of area (masking)?

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

How to stop drawing outside of area (masking)?

Schred
I am currently coding my own UI system using JOGL and would like to know how to only draw inside a certain area.

The system is structured like this:
-window
  -container
    -components (including other containers)
and I want the components of a container to only be able to draw in that container's area.

How would I go about doing this?
Reply | Threaded
Open this post in threaded view
|

Re: How to stop drawing outside of area (masking)?

Sven Gothel
Administrator
On 2/12/20 1:24 PM, Schred [via jogamp] wrote:

> I am currently coding my own UI system using JOGL and would like to know how
> to only draw inside a certain area.
>
> The system is structured like this:
> -window
>   -container
>     -components (including other containers)
> and I want the components of a container to only be able to draw in that
> container's area.
>
> How would I go about doing this?

Try the GL viewport.

On the other hand, it might be nice to have a seamless integration
of the scene and UI as we demo in GraphUI?

If you like (and are free) to collab on UI work,
please email me.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: How to stop drawing outside of area (masking)?

Schred
Thanks, I'll take a look at that! :D

Concering the collaboration: I like to do things myself - that way you learn the most. Thanks for the offer though!
Reply | Threaded
Open this post in threaded view
|

Re: How to stop drawing outside of area (masking)?

Schred
This post was updated on .
In reply to this post by Sven Gothel
Thanks, I got it now working with gl.glViewport()! One minor inconvenience is that TextRenderer now adjusts the size of the text according to the new viewport, meaning that the smaller the viewport is, the smaller the text is. Maybe I'll figure something out.
Reply | Threaded
Open this post in threaded view
|

Re: How to stop drawing outside of area (masking)?

elect
In reply to this post by Sven Gothel
Sven Gothel wrote
On the other hand, it might be nice to have a seamless integration
of the scene and UI as we demo in GraphUI?

If you like (and are free) to collab on UI work,
please email me.

~Sven
Hi Sven,

nice to see jogamp still alive!

I'm taking care of an imgui port, if you are interested, I may offer my support for resuming and update the jogl backend (actually outdated)
Reply | Threaded
Open this post in threaded view
|

Re: How to stop drawing outside of area (masking)?

gouessej
Administrator
Yes an update would be welcome. If something goes wrong, feel free to ask some help. I'm no longer on Github, don't expect any pull request.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to stop drawing outside of area (masking)?

gouessej
Administrator
In reply to this post by elect
By the way, avoid storing GL instances, I've just looked at your kotlin source code. Take the LibGDX JOGL backend as an example.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to stop drawing outside of area (masking)?

elect
In reply to this post by gouessej
gouessej wrote
Yes an update would be welcome. If something goes wrong, feel free to ask some help. I'm no longer on Github, don't expect any pull request.
I'll wait till 2.4 gets available on maven

gouessej wrote
By the way, avoid storing GL instances, I've just looked at your kotlin source code. Take the LibGDX JOGL backend as an example.
Yeah, relict, I was actually retrieving it properly each frame: https://github.com/kotlin-graphics/imgui/blob/master/imgui-jogl/src/test/kotlin/imgui/test%20jogl.kt#L95