Author Topic: Display just a portion of a dynamically-downloaded texture  (Read 2342 times)

eheimburg

  • Guest
Display just a portion of a dynamically-downloaded texture
« 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!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Display just a portion of a dynamically-downloaded texture
« Reply #1 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.

eheimburg

  • Guest
Re: Display just a portion of a dynamically-downloaded texture
« Reply #2 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!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Display just a portion of a dynamically-downloaded texture
« Reply #3 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.