Use RenderTargetTexture with TEXTUREFORMAT_R

Hello, I want to know when I create a RenderTargetTexture with type set as TEXTURETYPE_FLOAT and format as TEXTUREFORMAT_R, and use setMaterialForRendering to set a independent shader to this RTT, how do I write gl_FragColor in this shader?

like this?

float result = ...;
gl_FragColor = vec4(result, 1.0, 1.0, 1.0);

What happens if you try this method? :slight_smile:

You should set a vec4 as you do in your snippet, but the G/B/A values are not used (so you can set them to any value you want - it’s generally 0).