Transparancy & GDI rendered textures

All about the core api and animation, input, sound, effect, collision and physics engines.
You can also post here your feature requests.

Moderator: Brume Dev Team

Transparancy & GDI rendered textures

Postby Bartman on Fri Sep 19, 2008 8:03 am

Hi

I'd appreciate your help on the following issue....

I am rendering some dynamic content to the texture of a BrumeSquareTextured. The texture was created with :

Code: Select all
_texture = new BrumeTexture(engine, Guid.NewGuid().ToString(), w, h, 1, BrumeTextureParams.FORMAT_X8R8G8B8);


The shape of the content is not filling the entire texture (is non-rectangular). What I want to achieve is to make the areas outside the shape transparent. I've tried a lot of different things (e.g. using two textures) but can't seem to find the right combination. I also tried loading a PNG with correct transparency and then rendering over it (using Graphics gc = _texture.GetGraphics()). But in this case Brume reports an error about the texture format being incorrect for GDI rendering (Brume error : Brume.BrumeException: DirectX9Texture.GetGraphics() : texture format (A8R8G8B8) not supported with DC (you must use R5G6B5, X1R5G5B5, R8G8B8 or X8R8G8B8))

Maybe you have some clues?

Thanks a lot and take care!!

Bart van Haaff
User avatar
Bartman
Brume user
 
Posts: 23
Joined: Wed Oct 11, 2006 7:01 am
Location: The Netherlands

Re: Transparancy & GDI rendered textures

Postby Silmaryls on Mon Sep 22, 2008 7:27 pm

Hi Bart,

Well I checked the code in BrumeMdxTexture.GetGraphics() and I must tell you that I have no idea of the reason I put the limitation to R5G6B5 X1R5G5B5 R8G8B8 X8R8G8B8 formats.
I think that there was a reason but I just can't remember it :)

Can you try to comment the following lines in the source code (if possible) and check other formats ?

Code: Select all
if (desc.Format != Format.R5G6B5 && desc.Format != Format.X1R5G5B5 && desc.Format != Format.R8G8B8 && desc.Format != Format.X8R8G8B8)
{
    throw new BrumeException("DirectX9Texture.GetGraphics() : texture format (" + desc.Format + ") not supported with DC (you must use R5G6B5, X1R5G5B5, R8G8B8 or X8R8G8B8)");
}


If not send me a sample of your texture writing and I will do some tests myself.

Regards,
Silmaryls
User avatar
Silmaryls
Brume Team Member
 
Posts: 340
Joined: Tue Feb 21, 2006 10:09 pm
Location: Paris - France


Return to Technical discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron