@mystical wrote:
Hello everyone,
I'm trying to create a minimap using RenderTexture and a TMXTiledMap object in Cocos2d-X v3.10.
The code looks like this:
minimap_ = RenderTexture::create(map.width * tile.width, map.height * tile.height); minimap_->begin(); map->visit(); minimap_->end(); minimap_->setScale(...);
Works perfectly when the map is a smaller size, such as 30x30 or 50x50 tiles.
However, if the map file contains a large size like 100x100 tiles, the process memory can skyrocket as high as 450mb-500mb while it’s grabbing RenderTexture since the pixel size for the image grows pretty massive.
Is there a better way to grab a snapshot of a TMXTiledMap object and scale it down?
I've tried to scale down the TMXTiledMap object to 0.25 before running Node::visit(), but for some reason it still grabs the map at full scale. Ideally the RenderTexture::Create() could be set to 250x250, but I'm having trouble getting it to capture the full map unless RenderTexture is set to the same dimensions as the map.
RenderTexture::setKeepMatrix(true) is great except that it only captures screen and not the whole map.
Any help would be greatly appreciated, thank you!
Posts: 2
Participants: 2