Hi,
I'm new with DirectX and I'm starting with the December 2005 SDK. It seems like almost every tutorial or sample I've run into uses TextureLoader to retrieve textures. From what I've seen, and I've looked pretty hard, TextureLoader doesn't exist in Microsoft.DirectX.Direct3D anymore contrary to any documentation that I can find.
Well, instead I've been using Texture.FromBitmap to load textures, which I guess is okay... But I can't find any example of how to load transparent textures with Texture.FromBitmap. Again, all of the examples I've come across use some variation of TextureLoader which takes a colorkey to define the transparent value.
Is there a different means of loading textures that I'm supposed to use now that TextureLoader is gone Or am I looking in the wrong spot And if Texture.FromBitmap is my only alternative, how do I define transparent textures
Thanks for the help.

TextureLoader gone? Alternatives?
Brian Senecal
So i checked out C-Unit's tutorials that were just updated for the dec. 05' sdk and i'm still having the same problem with the Texture(device, path) not existing.
Here is the error:
TitleScreen.cs(214): No overload for method 'Texture' takes '2' arguments
I am using Visual Studio .NET 2003 on Windows XP Profession with SP1 (had massive problems with amd64 and SP2). I have ONLY the dec. 05 sdk installed (no october, etc...) and have also installed the .NET 2.0 SDK. Is there something I'm missing I really have no idea why something so trivial is giving me so many problems. Is there something I am missing that needs installed Does Visual Studio need to be updated to see the new SDK
Thx
Michael Klucher - MSFT
abarone
I have finally figured this @$#! out. Here is sample code that works with Dec. 05' sdk and doesn't use any of the deprecated functions:
Bitmap bmp = new Bitmap(file, false);
this.texture = Direct3D.Texture.FromBitmap(gd, bmp, 0, Direct3D.Pool.Managed);
This will load a bitmap file as a texture. The thing is, the file doesn't have to actually be a bitmap file! Here they are using the term bitmap in a generic sense to refer to an actual bit-map (just a bunch of bits in an image). Load a png (with transparency) and then set the alpha on your Direct3d.Device as follows:
gd.RenderState.AlphaBlendEnable = true;
gd.RenderState.AlphaBlendOperation = Direct3D.BlendOperation.Add;
gd.RenderState.DestinationBlend = Direct3D.Blend.InvSourceAlpha;
gd.RenderState.SourceBlend = Direct3D.Blend.SourceAlpha;
Happy Coding...
SaravanaKumar
This should work with transparent textures w/out much trouble:
Texture tex = new Texture(device, path);
shanecav
i tried "new Texture(device, path)" anyway which didn't work (cause it didn't compile). Is the best way to load a png (with transparency) as a stream and pass it along to the above constructor
Also, I heard that the new Dec. SDK is really just a beta. Is this part of the problem and should I fall back to the October SDK I really didn't want to learn DirectX on the October SDK only to have much of what I learned be deprecated before my project was even finished.
Anyway, any input, advice, or suggestions would be appreciated.
Thx
Dragos.Stefanescu
AbiBaby
You can either load from a bitmap or from a stream:
public static Texture FromBitmap(Device device, Bitmap image, Usage usage, Pool pool);
public static Texture FromStream(Device device, Stream data, Usage usage, Pool pool);
and neither ask for a transparent color value like TextureLoader.
Has anyone succesfully used the Dec. 05 SDK to load transparent textures
Please help.
Ajay Verma
I know it is not exactly the same, but I am using the following code within a try/catch to load a PNG with alpha channel,
m_texLogo = new Texture(m_Device, new Bitmap(this.GetType(), "Images.matchit_logo.png"), 0, Pool.Managed);
Then I set the device to use alpha blending. I know it is not the exactly the same, but maybe it will point you in the proper direction.
d3D.RenderState.SourceBlend = Direct3D.Blend.SourceAlpha;
d3D.RenderState.DestinationBlend = Direct3D.Blend.InvSourceAlpha;
d3D.RenderState.AlphaBlendEnable = true;
M_Hagen
As Tom indicated, it's an instance method now. See the method under the Texture class: Texture.FromBitmap (or, equivalently, the Texture constructor that uses a bitmap)