One more question
One more question
One more question
One more question
One more question
One more question One more question One more question One more question One more question One more question One more question One more question
One more question One more question
One more question
Go Back  Xtreme Visual Basic Talk > > > > One more question


Reply
 
Thread Tools Display Modes
  #1  
Old 07-10-2008, 12:37 PM
iprogram iprogram is offline
Regular
 
Join Date: Jan 2008
Posts: 55
Default One more question


I am new to managed directx, but not new to game programming. I am having trouble making my sprites transparent with the background. The sprites that came with the my book are transparent with the background, but whenever I try to make my own sprites, they are not.


Could someone please help?
Reply With Quote
  #2  
Old 07-10-2008, 12:57 PM
darkforcesjedi's Avatar
darkforcesjediOne more question darkforcesjedi is offline
Trust me, I'm an

* Expert *
 
Join Date: Apr 2001
Location: In ur base, pwnin d00dz
Posts: 1,964
Default

Are you using the MDX Sprite class or are you creating a sprite from 2 textured triangles?

I've spent an hour yesterday trying to figure out how to do this with textured triangles with no success.

What file are you using as the texture source? Does it have an alpha channel or do you want to specify a color key (invisible color)?

Make sure you set the Device.RenderState's blend properties (AlphaBlendEnable, SourceBlend, DestinationBlend). Also, there's some general MDX info here: http://www.mdxinfo.com
__________________
To err is human; to debug, divine.
Reply With Quote
  #3  
Old 07-10-2008, 04:42 PM
iprogram iprogram is offline
Regular
 
Join Date: Jan 2008
Posts: 55
Default

Quote:
Originally Posted by darkforcesjedi View Post
Are you using the MDX Sprite class or are you creating a sprite from 2 textured triangles?
I'm using MDX Sprite Class

Quote:
Originally Posted by darkforcesjedi View Post
I've spent an hour yesterday trying to figure out how to do this with textured triangles with no success.

What file are you using as the texture source? Does it have an alpha channel or do you want to specify a color key (invisible color)?

Make sure you set the Device.RenderState's blend properties (AlphaBlendEnable, SourceBlend, DestinationBlend). Also, there's some general MDX info here: http://www.mdxinfo.com
How do you add an alpha channel to your images??? I'm just trying to make a 2d game at this point.



Edit: I figured it out. Thanks!

Last edited by iprogram; 07-10-2008 at 05:03 PM.
Reply With Quote
  #4  
Old 07-11-2008, 05:39 AM
darkforcesjedi's Avatar
darkforcesjediOne more question darkforcesjedi is offline
Trust me, I'm an

* Expert *
 
Join Date: Apr 2001
Location: In ur base, pwnin d00dz
Posts: 1,964
Default

PNG and DDS formats support alpha channels (there are other formats too, but these are the only ones that MDX texture loader supports). I used to work with PNG files a while back. Programs like Paint Shop Pro and PhotoShop have tools for generating alpha channels. Typically they'll generate an alpha channel (or several channels for layered images) based on some image characteristic (pixel brightness, color, etc). Then you can edit the alpha channels like any other layer.

Color keys can be used to make 1 particular color of the image transparent. In the TextureLoader.FromFile method, use Color.FromARGB(A, R, G, B) for the color key. Be aware that the alpha values have to match (for images with an alpha channel) for the color key to work. If the image doesn't have an alpha channel, then the alpha value should be 255. If you want to render a PNG with transparency, load the texture using the simplest overload TextureLoader.FromFile(_DXDevice, FileName).
__________________
To err is human; to debug, divine.
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

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
One more question
One more question
One more question One more question
One more question
One more question
One more question One more question One more question One more question One more question One more question One more question
One more question
One more question
 
One more question
One more question
 
-->