- This topic has 2 replies, 2 voices, and was last updated 7 years, 1 month ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › [SOLVED] Retrieve Sofa Scene's OpenGL Viewport from within a component
Tagged: 64_bits, glReadPixels, Linux_other, OpenGL, SOFA_1706, viewport
Hi there,
I’m trying to retrieve the viewport of the scene view inside a SOFA component, but calling glGet(GL_VIEWPORT, &viewport) gives me the viewport of the entire window.
What I need, is the offset and sub-dimensions of the 3D scene view.
With runSofa, I could manually compute the offset and thus get the exact Scene dimensions, because the UI isn’t that dynamic, and the left panel’s dimensions are not saved and restored between 2 launches of runSofa.
With runSofa2 though, window panel’s settings are highly dynamic and configurable, and are saved between executions.
So is there a way to retrieve this information? maybe from the drawtools (haven’t found it..) or from the rootContext..?
Looking forward to your answers š
Hey @bmarques
Did you succeed to solve your issue?
Sorry, but I never did what you wanna do.
Cheers,
Hugo
Hi @hugo,
Thanks for your reply!
I investigated a bit further and found out a saveScreen() method in helper::gl::Capture.
This function does the screen grab (call to glreadpixels) in runSofa, but will not have the expected behavior in runSofa2.
For now, since runSofa2 is not yet fully implemented, I will use runSofa whenever I need this feature, and will maybe try to implement it in a near future.
I also think that it would be interesting to expose this kind of features through SofaPython, but that is a conversation for sofa’s issue tracker more than the forum I guess =)
Thanks anyways! I’ll close this topic
– Bruno
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.