Jump to content
  • Advertisement
Sign in to follow this  
BigBeginner

Direct3D8 CLEAR with alpha-blend

This topic is 4845 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

Hello, My achieve: drawing rectangles with CLEAR function of Direct3D8: CLEARRECT.X1:= 10; CLEARRECT.Y1:= 10; CLEARRECT.X2:= 30; CLEARRECT.Y2:= 30; Device.Clear (1, CLEARRECT, D3DCLEAR_TARGET, D3DCOLOR_ARGB(70, R,G,B), 0,0); Thats ok, but the result isnt alpha blend despite of I used D3DCOLOR_ARGB function. What can I do? These commands arent working: Device.SetRenderState(D3DRS_ALPHABLENDENABLE, 1); Device.SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCCOLOR); Device.SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR); [Edited by - BigBeginner on August 10, 2005 7:17:19 AM]

Share this post


Link to post
Share on other sites
Advertisement
Clearing the backbuffer to a value with alpha will only work/be useful if:
1) You have a backbuffer with a format that has an alpha channel
2) You use DESTALPHA/INVDESTALPHA in your alpha blending setup.

Now, what are you trying to do exactly? (I don't get the "drawing rectangles with CLEAR" part)

Share this post


Link to post
Share on other sites
1, my backbuffer has got ALPHA channel (created by D3DFMT_A8R8G8B8 format)
2, can you explain that with some code? How to use it?

Well, I want to draw color-filled rectangles like this. The vertexbuffer can be more difficult way.

Share this post


Link to post
Share on other sites
Clearing just sets each pixel in that given rect to a certain value. It's not "rendering" in the same sense as drawing a triangle, so render states are ignored. If you want to be able to draw alpha-blended rects you'll need to use triangles. It's more efficient too.

If vertex buffers are intimidating you can use a plain array with DrawPrimitiveUP.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!