5

I have been posting on 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 manipulate the camera preview. To do this, I need to load my own texture to the fragment shader. Thus, I have the camera's texture as a samplerExternalOES, and my own texture as a sampler2D. I saw one reply saying there is a bug with trying to use both these texture types in one fragment shader. Can anyone shed some light on this for me? Why can't you use a samplerExternalOES and a sampler2D texture in the same shader? And what would be the best way around this problem?

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
MikeShiny
  • 284
  • 6
  • 15
  • 1
    Can you show the fragment shader ? What error do you get ? – Fabien R Feb 02 '13 at 11:28
  • There may be a hardware limitation in your devices codec, but I doubt it. I know you can't print to screen and out to a FBO in the same pass. To work around this you just make two passes... One program (vertex fragment shader pair) writes out to Screen and then switch out puts and re-run... – izzy Dec 30 '14 at 19:56
  • Some more info in case anyone else runs into this: http://stackoverflow.com/questions/13376254/android-opengl-combination-of-surfacetexture-external-image-and-ordinary-textu – msfeldstein Jun 03 '15 at 03:13

1 Answers1

3

You may use render-to-texture to solve your problem.

Render samplerExternalOES and sampler2D in separate FBOs before merging them as a final rendering.

Fabien R
  • 685
  • 1
  • 8
  • 24