How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures?
How do I resize D3D9 Textures? How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
Go Back  Xtreme Visual Basic Talk > > > > How do I resize D3D9 Textures?


Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2004, 03:58 AM
Virgo Virgo is offline
Regular
 
Join Date: Oct 2002
Posts: 69
Default How do I resize D3D9 Textures?


How do I resize textures with D3D9? I'm coding a tile engine and use character sets and tilesets.

Before, when I used DDraw7 and surfaces, it was easier because my source rect variables were only needed for the sprites. Now with D3D9, I need to actually change the source rect for the texture. For example:

I have a character set which is 2x4 tiles each tile 32 pixels. Horizontally for each walking frame, vertically for each direction. When I create the texture, It automatically stores the size of the texture to 64x128. Now when I draw this texture to the screen, it will show the whole character set.

So I need to resize the texture to a 32x32 chunk depending on the animation frame and direction. This means I need to access the texture and resize it each time. I've looked all over and can't find how to resize the texture object.

On a side note, this seems non-efficient. Suppose I have a soldier texture, and 50 soldier sprites all moving around on screen at the same time. These 50 soldiers all use this one texture, but each has a different source rect, based on their direction and animation. I would need to access the texture object and change it's size many times per frame.

With DDraw7 and surfaces, It was easier, because I only needed to keep a source rect variable for each sprite, and draw chunks from the character set. The main difference, is that I'm not accessing the texture and resizing it, I'm just changing the parameters from which to draw from (source rect).

So my second question is, is there a better way in handling D3D9 textures or am I forced to resize the texture each time?
Reply With Quote
  #2  
Old 08-21-2004, 01:32 AM
Xebec Xebec is offline
Newcomer
 
Join Date: Aug 2004
Location: Gourock, Scotland
Posts: 1
Default

well from my limited experience...

when your drawing a sprite using Sprite.Draw, something like...

Code:
sprite.Draw(texture,new Rectangle(srcpoint,srcsize),v3center,v3position,Color.White);
the Rectangle defines which portion of the texture you wish to draw - in your case you would set its size to 32x32 then adjust the point according to which frame you wantto draw(all within the same co-ordinate space as your texture...so first frame would be point(0,0) second frame point(32,0) etc). As for scaling the sprite just apply a scaling transform prior to the draw.

hehe kind of new to this stuff meself so hope that helps

Xeb

ed:

doh...my bad..this post was from ages ago...thats what I get for posting so early in the morning...apologies

Last edited by Xebec; 08-21-2004 at 01:50 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
capture min button click, NOT RESIZE EVENT skimz General 2 11-27-2003 10:30 PM
Resize, and textures AndrewMac44 DirectX 3 11-15-2003 11:35 AM
resize objects(controls) in a form resize skilit Interface and Graphics 4 09-23-2003 09:26 PM
Managing Textures zoso DirectX 0 11-16-2002 04:17 PM
Form Resize & Controls koqui General 17 05-02-2002 09:33 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
How do I resize D3D9 Textures? How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures? How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
 
How do I resize D3D9 Textures?
How do I resize D3D9 Textures?
 
-->