Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know how to create a Texture feedback effect in Stage3D / AGAL?

I've just found the term "ping-ponging" in some GPU wikipage, hopefully I'm using it in the right place!

I'll share with you my sample code portion responsible for alternating between the source and destination Texture targets:

protected override function _draw():void {

        var src:int =   _textureFlip;
        var dest:int =  1 - _textureFlip;

        context3D.setRenderToTexture(_texturePair[dest], false, 0, 0); //
        context3D.setTextureAt(0, _textureNoise);
        context3D.setTextureAt(1, _texturePair[src]);
        context3D.drawTriangles(_quadIndices.buffer, 0, 2);

        context3D.setTextureAt(0, _texturePair[dest]);
        context3D.setTextureAt(1, null);
        context3D.drawTriangles(_quadIndices.buffer, 0, 2);


        _textureFlip =  1 - _textureFlip;

Now... if I run the bottom portion by itself (and swap _texturePair[dest] with '_textureNoise'), I can see my texture fine.

Maybe I'm forgetting something in my AGAL code, but I figured I should ask here first for any guidelines.

Is it possible I have to upload some startup data (blank rect, black, white, anything!) in my first input-texture before the very first target texture is being rendered to?

  • Do I need to clear the Texture targets first?
  • Do I need to set the blend factors between switching from BackBuffer vs. Texture Targets?

Would very much appreciate your help :)

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.