Sign in to follow this  
Solid_Spy

Directx 9 surfaces with alpha don't work!

Recommended Posts

Hey, i've been trying to draw a surface to the backbuffer using stretchrect(); and it works, but doesn't send in the alpha.

I've set the render states for alpha blending to true:

d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
d3ddev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
d3ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

and i've loaded the surface successfully:

D3DXLoadSurfaceFromFile(tilesurface1, NULL, NULL, "Title_Screen_text1.png", NULL, D3DX_DEFAULT, 0, NULL);

And also, i have the backbuffer format set to A8R8G8B8.

3d models that are textured seem to work fine with alpha blending, but surfaces don't.

I'm using stretchrect for drawing my surfaces, is this a bad thing? I've heard of this thing called "BlittoSurface", but i don't know how to use it. Can someone please help me?

Share this post


Link to post
Share on other sites

I guess i'll just have to resort to using 3d quads. it would probably be better anyways since it would make it so that i can apply some cool 3d effects to it. However, i still wan't to learn how to make surfaces with alpha. Please help me.

 

(And sorry for the outburst earlier. This was fustrating me for a while.)

Edited by Solid_Spy

Share this post


Link to post
Share on other sites
[quote name='Solid_Spy' timestamp='1354929320' post='5008300']
i guess i'll just have to resort to using 3d quads
[/quote]Yep, StretchRect isn't a "real" drawing function, in that it doesn't respect all your render-states. Drawing a quad (or a triangle) is the right thing to do.

Share this post


Link to post
Share on other sites
[quote name='Hodgman' timestamp='1354930274' post='5008306']
[quote name='Solid_Spy' timestamp='1354929320' post='5008300']
i guess i'll just have to resort to using 3d quads
[/quote]Yep, StretchRect isn't a "real" drawing function, in that it doesn't respect all your render-states. Drawing a quad (or a triangle) is the right thing to do.
[/quote]

Ok, however, I found this cool function called UpdateSurface, however it isn't much different from stretchrect it looks like, but it still doesn't fix the alpha problem.

I want to be able to draw surfaces over other surfaces for shader effects as well, such as adding bloom to an original image, how would i get the alpha to work? This is literally driving me nuts. Edited by Solid_Spy

Share this post


Link to post
Share on other sites

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