How to draw a cutout or hole on the camera's opengl view?
See original GitHub issueI need to crop the camera view to a circle shape.
I tried using a surface view and overriding dispatchDraw(Canvas c)
, which worked. However it does not work when placed on top of another surface view.
So now I am using an OpenGlView and trying to figure out how to crop the display to a circle?
I assume this should be done with a filter, but I have no idea where to start.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Camera - LearnOpenGL
Subtracting the camera position vector from the scene's origin vector thus results in the direction vector we want. For the view matrix's coordinate...
Read more >Support display cutouts - Android Developers
A display cutout is an area on some devices that extends into the display surface. It allows for an edge-to-edge experience while providing ......
Read more >Animate 3 Online Help: OpenGL Drawing Preferences
You can change the value of the Full Scene Antialiasing using the Preferences dialog box, to fit the current level used in the...
Read more >How to convert a screen coordinate into a translation for a ...
2 Answers 2 · Set up main scene (model/view/projection matrices, etc.) · Use glScissor to set the rectangle for the overlay. · Call...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I assume that only preview should be circular right? In this case you need modify so much the library because filters are developed to apply in stream result and preview. I will try do a demo but I will not support it in the future.
I found a way to do it by setting the outline of the camera view to a circle. Turns out this method can be used to crop and view to a circle.
This is the Kotlin code I use to do it. Note that I crop a little extra to allow room for another view to show a border.