Page 1 of 1

Render Targets with Opengl ES 2.0

Posted: Wed May 29, 2013 6:48 pm
by jazz
Does Opengl ES 2.0 support using the Render Target Component?

Can't seem to get it working.

Posted: Thu May 30, 2013 7:35 am
by VilleK
I'm not sure, it looks like it should work from this tutorial: http://blog.shayanjaved.com/2011/05/13/ ... o-texture/
Which use the same API functions as ZGE.

Can you post zgeproj-file for us to test?

Posted: Thu May 30, 2013 2:33 pm
by jazz
I was following the RenderTexture example.

Seem like I should sample my render target texture in the fragment shader for the final image. But not sure how to send the image to the shader.

Posted: Thu May 30, 2013 2:39 pm
by Kjell
Hi jazz,
jazz wrote:Seem like I should sample my render target texture in the fragment shader for the final image. But not sure how to send the image to the shader.
Correct. Any textures you add to the Material component are passed to the shader automatically ( as sampler2D ) using the naming convention tex1, tex2 etc. So simply add the line "uniform sampler2D tex1" in your fragment shader to access the RenderTarget you've applied to the Material.

K

Posted: Thu May 30, 2013 2:56 pm
by jazz
Yep. Worked like a charm.

Thanks for the quick reply Kjell.