Android: how to use samplerExternalOES and sampler2D in the same shader snippet

I was posting here like crazy trying to get my fragment shader code to work. I finally stumbled upon something that might fix what is wrong.

I am trying to use OpenGl ES 2.0 on Android to control the camera preview. For this I need to load my own texture into the fragment shader. So I have a camera texture as samplerExternalOES and my own texture as sampler2D. I saw one answer saying that there is an error trying to use both of these texture types in the same fragmentator. Can anyone shed some light on this for me? Why can't you use samplerExternalOES and sampler2D texture in the same shader? And what would be the best way to solve this problem?

Any feedback is appreciated.

Thank,

Mikeshiny

+3


source to share


1 answer


You can use render-to-texture

to solve your problem.



Render samplerExternalOES

and sampler2D

in separate FBOs before merging them as the final render.

+2


source







All Articles