Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Directx 9 surfaces with alpha don't work!

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 Solid_Spy   Members   

708
Like
0Likes
Like

Posted 07 December 2012 - 10:59 AM

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?

#2 Solid_Spy   Members   

708
Like
-1Likes
Like

Posted 07 December 2012 - 07:15 PM

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, 13 September 2015 - 12:39 AM.


#3 Hodgman   Moderators   

50624
Like
1Likes
Like

Posted 07 December 2012 - 07:31 PM

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.

#4 Solid_Spy   Members   

708
Like
0Likes
Like

Posted 07 December 2012 - 08:40 PM

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.


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, 07 December 2012 - 10:15 PM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.