Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: eheimburg on July 28, 2012, 05:16:55 AM

Title: Display just a portion of a dynamically-downloaded texture
Post by: eheimburg on July 28, 2012, 05:16:55 AM
I need to download a lot of GUI textures for my MMO (all the various icons for items -- thousands of them! -- though obviously only a handful will be visible at a time). Right now I'm using UITextures for each icon, but I'm worried about the number of draw calls when displaying the inventory screen (it has 100+ items visible, so that's 100+ draw calls, right?).

My first thought is to bundle the icons into strips, and then just display a selected rectangle of the texture for each icon. How would I do this, and would it help (that is, would it reduce the number of draw calls)?

Thanks!
Title: Re: Display just a portion of a dynamically-downloaded texture
Post by: ArenMook on July 28, 2012, 11:42:25 AM
Draw calls mean very little on a PC platform. Once you exceed 10,000, then you should start worrying. I can add code to the UITexture to display only a part of the texture though. Fairly easy thing to do.
Title: Re: Display just a portion of a dynamically-downloaded texture
Post by: eheimburg on July 29, 2012, 06:57:05 AM
Okay, I won't worry about the performance for now then. (But I think it'd be useful functionality anyway.)

Thanks!
Title: Re: Display just a portion of a dynamically-downloaded texture
Post by: ArenMook on July 29, 2012, 07:28:47 PM
Just a footnote, I've added a way to specify a UV rect, and also changed UITexture so that you can now specify only the texture (and optionally also a shader) that will be used to draw it. No need to specify a material anymore (unless you want to). You'll see this change in the next update.