Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 23 Aug 2004
Offline Last Active Oct 13 2012 05:54 AM

Topics I've Started

High performance texture splatting?

18 June 2012 - 05:40 AM

Is there a way to improve the performance of texture reads in OpenGL (ES)?
I'd like to do texture splatting but I'm running into severe performance problems when using multiple texture reads in my fragment shader. With a single texture, I get a constant 60fps (vsync limited, with room to spare). Adding a second texture read, my performance drops down to 40fps and with the shader provided below, performance is down to 15fps.

Any ideas?

[source lang="plain"]# Simplified fragment shader for demonstration purposesvarying lowp vec2 v_texcoord;varying lowp vec4 v_color;uniform sampler2D texture0;uniform sampler2D texture1;uniform sampler2D texture2;uniform sampler2D texture3;uniform sampler2D texture4;void main(){ lowp vec4 alpha = texture2D(texture4, v_texcoord); lowp vec4 color = texture2D(texture0, v_texcoord); color = mix(color, texture2D(texture1, v_texcoord), alpha[0]); color = mix(color, texture2D(texture2, v_texcoord), alpha[1]); color = mix(color, texture2D(texture3, v_texcoord), alpha[2]); gl_FragColor = v_color * color;}[/source]

GL_RGB_SCALE and multipass rendering

22 March 2009 - 01:44 PM

I'm rendering my level geometry using multitexturing (Texture * Lightmap, the usual stuff). In the texture combiner setup for the lightmap, I use GL_RGB_SCALE to brighten up the result. Currently I'm implementing some special effects, requiring parts of the geometry to be rendered in multiple passes, with the lightmap pass coming last. Since the lightmap is rendered "standalone" in this situation, GL_RGB_SCALE doesn't affect the result. Is there a way to create a combiner setup to make GL_RGB_SCALE work in this situation?