Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hey,

 

So I've recently begun working with directx in vb.net but Ive run in to a small problem. I can only render sprites that have power of 2 dimensions. I am aware that the texture of the sprite has to be based off an image with power of 2 dimensions, but Im fairly sure that there must be a way to render the spirte itself in something other than power of 2 dimensions using sprite.draw2d.

 

It would be great if any of you could help me.

 

Thanks!:)

Posted

I have never tried, I didn't even know that you couldn't.

 

I'm curious why you need to though? Whats the reason for it?

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted
well, maybe I'm missing something, but if I can only render sprites with power of 2 dimensions there's only a certain amount of sprite sizes I can pick from. So I cant get exact sprite sizes.
Posted
You should be able to Scale the sprites using floating point values to get them exactly the size you want.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted

I'm still a little confused. As far as I can tell the only parameters you can plug in to either textureloader.fromfile or sprite.draw2D are integers.

 

Also, I should have mentioned this earlier, but if I try to scale it by plugginig in numbers that are not powers of 2 in the parameters for length and width in the textureloader.fromfile function it automatically rounds up to the length/width to the next power of two.

Posted

Yes, PD is correct: something roughly like this should work for you.

sprite.Begin(SpriteFlags.None);

sprite.Draw2D(texture, Rectangle.Empty, Rectangle.Empty,
             new Point(5.0f, 5.0f), Color.White);
sprite.End();

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...