Sign in to follow this  

rendering to surface / no transparancy?

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Instead of using bitmaps for my text (pre rendered), I'd like to make my simple 2D text at startup by rendering it to a surface. It works pretty fine, I simply see a black 256x256 square with my message in Trebuchet. No problems there. But, I just cannot get the black background to be transparant, so that only the white text is visible. it's probably something simple, but I just cannot find the problem. Ofcourse I've tried the standard SrcBlend/DestBlend alpha blend operations. Making the render to texture: Set m_oTexture = objD3DX.CreateTexture(objDev, SURFACE_SIZE, SURFACE_SIZE, 1&, 0&, D3DFMT_R5G6B5, D3DPOOL_MANAGED) Render surface: Set oRTS = g_oD3DX.CreateRenderToSurface(g_oD3DDevice, SURFACE_SIZE, SURFACE_SIZE, _ DispMode.Format, 0&, D3DFMT_UNKNOWN) Clearing the render surface: g_oD3DDevice.Clear 0&, ByVal 0&, D3DCLEAR_TARGET, &HFF000000, 1!, 0& I hope someone knows the solution to this slightly annoying problem :) Thanks :)

Share this post


Link to post
Share on other sites
This may or may not be the problem, but I noticed that you are using R5G6B5 format for your surface. This format does not have an alpha channel. You may be limited by your graphics card as to what formats you can use, but try using A8R8G8B8 (32bits) , A1R5G5B5 or A4R4G4B4 (both 16bits).

Hope this helps.

Share this post


Link to post
Share on other sites
Unfortunatly, anything else than the R5G6B5 one will give errors.

I couldn't find anything on this at google, while I'm just sure that I'm not the only one trying to get something like this to work.. :)

Share this post


Link to post
Share on other sites
Take a look at the Adapter Formats for your card in caps viewer, perhaps your card supports some other format. The card on my current this computer only supports using A8R8G8B8 and X8R8G8B8 as valid texture render targets ,in 'Fullscreen X8R8G8B8', and only R5G6B5 in 'Fullscreen R5G6B5.'

You might try looking for some combo of formats for your adapter/surface that allows you to write an alpha channel.

Share this post


Link to post
Share on other sites
I just ran into this problem myself. I was rendering to an X8R8G8B8 texture, and I couldnt clear it to a transparent color. I changed this my making the texture A8R8G8B8. Unfortunately, it's totally up to your video card if you can do this. Check your device caps.

Share this post


Link to post
Share on other sites

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this