Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dartpy] Allow setting background color for OSG windows #1393

Closed
chhinze opened this issue Aug 15, 2019 · 3 comments
Closed

[dartpy] Allow setting background color for OSG windows #1393

chhinze opened this issue Aug 15, 2019 · 3 comments

Comments

@chhinze
Copy link
Contributor

chhinze commented Aug 15, 2019

Problem
In DART, the background color of an dart::gui::osg::Viewer can be set in the constructor with a ::osg::Vec4 vector. This behaviour is also exposed in the python bindings, but the type ::osg::Vec4 is not defined. As far as I see, there is curently no possibility to set a background color.

Solution
Adding an __init__ function binding for dartpy.gui.osg.Viewer and dartpy.gui.osg.ImGuiViewer with an Eigen::Vector4f would allow to set the color either with a numpy array or even via a list with 4 entries.
I already wrote a solution for myself (see master...chhinze:fix/pyColorSupportOsgViewer) and would like to merge it, if desired.

Alternatives
There may be some OSG python binding projects, but I would prefer reducing the number of required Python packages.

@jslee02
Copy link
Member

jslee02 commented Aug 15, 2019

The solution sounds good to me.

Indeed, I'd prefer minimizing the third-party library APIs to the public DART APIs for both C++ and Python. In that sense, I'd add a new constructor of dart::gui::osg::Viewer taking Eigen::Vector4f (and setClearColor(const Eigen::Vector4f), and update the Python bindings accordingly.

There may be some OSG python binding projects, but I would prefer reducing the number of required Python packages.

Agreed for the same reason above.

@jslee02
Copy link
Member

jslee02 commented Aug 17, 2019

I believe this is resolved by #1393. Thanks for the fix @chhinze!

@jslee02 jslee02 closed this as completed Aug 17, 2019
@chhinze
Copy link
Contributor Author

chhinze commented Aug 17, 2019

Thank you for merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants