user3728425
user3728425

Reputation: 183

How to add a OpenGl object into a surfaceView camera?

I'm not certain how to implement the object made from OpenGl into the surfaceView of the Camera. Is it possible to set the OpenGl objectinto a custom android camera that uses surfaceView. ?

Upvotes: 1

Views: 553

Answers (1)

fadden
fadden

Reputation: 52313

No.

The SurfaceView's Surface has a producer-consumer relationship. In this case, the producer is the Camera, and the consumer is the system compositor (surfaceflinger). To draw on the Surface with OpenGL ES, you would need to attach OpenGL as the producer, and a Surface cannot have two producers at the same time.

What you can do instead is create a second SurfaceView, and call setZOrderMediaOverlay() to put it above the Camera-driven Surface but below the UI, then render on that with GLES. See Grafika's "multi-surface test" for a demonstration of overlapping SurfaceViews.

Upvotes: 1

Related Questions