We have been working on the android NDK project that uses opengles2.0 and successful in rendering the 3d models. But unable to learn "RenderToTexture" functionality, which draws the output to desired texture. What's the procedure?
Asked
Active
Viewed 106 times
1
-
1So, you want to render to an FBO? – fadden May 02 '14 at 14:35
-
@fadden Yes, its working fine in iOS, but not in android NDK. – Karthik Sivam May 06 '14 at 06:36
-
1You can see an example in Grafika's "Record GL app" activity (https://github.com/google/grafika). The code is in Java, but that doesn't change anything -- the Java APIs are just thin wrappers for the native calls. – fadden May 06 '14 at 14:40
1 Answers
1
Render to texture, and then using that texture for further rendering - involves first creating the fbo and binding as the current render target, doing the first pass render, then setting up this rendered texture as an input, and rendering it again. The shaders that are used in both the steps, and other states could be different.
Assuming all other states remain the same, a simple approach to rendering offscreen and reusing it as input (this is native C, not NDK, but the API and flow should be same) is described in:

Prabindh
- 3,356
- 2
- 23
- 25