Jump to content

Some inverted image while rendering multiple groups into multiple RenderTextures


Recommended Posts

Hello! I have an issue that I didn't understand too much. 

I'm trying to build a tiled-isometric-map loader for Phaser, where I have many issues about perfomance. So I will investigate different techniques to make them more lightweight for CPU/GPU trying to use some techniques like render the map layers in cropped RenderTextures (just draw the visible area of the map at once), using sprite-populated SpriteBatches/Groups as source (I tested with both). 

In simple words, the logical behind this is the following: 

  • Populate the SpriteBatch/Group with tile-based sprites from a cache-array (to prevent creating/destroying each time).
  • Render that SpriteBatch/Group into the RenderTexture, clearing it before that.
  • Cleaning the SpriteBatch/Group, putting the tile-based sprites back to the array and removing from the SpriteBatch/Group (without destroying them, off course).
  • Create a Phaser.Image that show the RenderTexture in the screen. (Or create once, the texture are updated anyways).

I tested that with one RenderTexture and works fine. The issue comes if I write more many of them (Assuming that 1 RenderTexture is equivalent at 1 Layer of the scenario), the screen starts showing y-inverted versions of the RenderTexture at random times. 

A important fact that this just occurs in WebGL mode (in Canvas the behaivour is the correct). I'm using Phaser CE 2.7.3.

I coded a short example of the issue (each column is a different RenderTexture with correspondent Sprites), you're free to see and debug them :) :

Canvas: http://elsemieni.net/inni/testCanvas/

WebGL: http://elsemieni.net/inni/testWebGL/

Some idea of what's going on there? Thanks in advance :)

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...