Jump to content

Should I worry with generateTexture size?


manelis
 Share

Recommended Posts

Hello,

 

I am using pixi on the creation of a strategy browser game map. This map was previously implemented in flash but was extremely heavy, due to the large number of objects. 

 

In My first implementation in pixi I was just using one sprite for each hexagon, city, road, etc, and was incredibly slow. However, considering that the map is mostly static and we just drag it around, I was thinking about generating textures for most of the scene nodes, which would drasticaly decrease the number of objects in the scene.

 

Example:

var texture = fow_shared.generateTexture();fow_shared = new PIXI.Sprite(texture);fow_shared.alpha = 0.7;fow_shared.position.x = jsmap.getMapXPos(jsmap.minX, jsmap.minY);fow_shared.position.y = jsmap.getMapYPos(jsmap.minX, jsmap.minY);shared.addChild(fow_shared);

My question is, should I need to worry about the size of the texture created by generateTexture (and so, break it in smaller parts) or does pixi take care of it?

 

Here is a example from the code above:

 

almansur-fog.png

 

The fog of war is just one texture. Considering that each hexagon is 250x172, the texture is now 3240x2236, however, I need to support much bigger maps than this.

 

Thank you for the help.

Link to comment
Share on other sites

Texture size matters. Head over to http://webglstats.com/, scroll to the bottom so all the graphs load, and look at MAX_TEXTURE_SIZE. That is some stats on the largest texture size people's GPU can handle. Increasing texture size will increase memory usage, bandwidth needed to talk to the GPU, memory used on the GPU, etc. Pixi does nothing magical to break apart large textures for you, that is application specific.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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