Directx 9 surfaces with alpha don't work!

Started by
2 comments, last by SolDirix 11 years, 4 months ago
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?

View my game dev blog here!

Advertisement

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.)

View my game dev blog here!


i guess i'll just have to resort to using 3d quads
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 name='Solid_Spy' timestamp='1354929320' post='5008300']
i guess i'll just have to resort to using 3d quads
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.

View my game dev blog here!

This topic is closed to new replies.

Advertisement