Sign in to follow this  
Rich76

Texture sheet power of 2, but what about the images within?

Recommended Posts

Rich76    207
(Sorry, my second post of the day) As I understand it, textures should be power of 2, so I am making my texture sheets 2048x2048. Now, do the images within the sheet need to be power of 2? I mean can I place a 100x100 image inside the 2048x2048 texture sheet and then draw the sprite like so?:
//Load 2048x2048 sheet   
Texture texture = TextureLoader.FromFile(device, Directory.GetCurrentDirectory() + "\\graphics\\texsheet0.dds",
  0, 0, 1, 0, Format.Unknown, Pool.Managed, Filter.None, Filter.None, 0);
  
//draw 100x100 sprite   
sprite.Draw(texture, new Rectangle(0, 0, 100, 100)Vector3.Empty, new Vector3(plotX, plotY, 0), Color.White.ToArgb());  





I'm asking because I'm using the nvidia texture atlas tool to create my 2048x2048 sheets, however, when I add my 100x100 sprites to the texture, the tool resizes them to 128x128..

Share this post


Link to post
Share on other sites
jtagge75    139
Once the texture has been loaded you can cut it up into any way you like to render it to screen.

Though techically if your sprites are 100x100 then your draw rect is going to be from 0-99.

Share this post


Link to post
Share on other sites
Rich76    207
Quote:
Original post by jtagge75
Once the texture has been loaded you can cut it up into any way you like to render it to screen.

Though techically if your sprites are 100x100 then your draw rect is going to be from 0-99.


Oops, thanks. :))

Do you know of a tool that is like nvidia's texture atlas tool, but allows you to add non-power of 2 images to a power of 2 texture? It would take me way too long to create myself..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this