Render Targets with Opengl ES 2.0

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
jazz
Posts: 16
Joined: Sun Mar 24, 2013 2:46 am

Render Targets with Opengl ES 2.0

Post by jazz »

Does Opengl ES 2.0 support using the Render Target Component?

Can't seem to get it working.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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?
jazz
Posts: 16
Joined: Sun Mar 24, 2013 2:46 am

Post 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.
Attachments
GLES2D-RenderTexture.zgeproj
(2.77 KiB) Downloaded 455 times
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
jazz
Posts: 16
Joined: Sun Mar 24, 2013 2:46 am

Post by jazz »

Yep. Worked like a charm.

Thanks for the quick reply Kjell.
Attachments
GLES2D-RenderTexture.zgeproj
(2.92 KiB) Downloaded 442 times
Post Reply