Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Directx 9 surfaces with alpha don't work!


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   -  Reputation: 454

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?

Sponsor:

#2 Solid_Spy   Members   -  Reputation: 454

Like
-1Likes
Like

Posted 07 December 2012 - 07:15 PM

Alright, well if no-ones able to help me, 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.

Edited by Solid_Spy, 07 December 2012 - 07:23 PM.


#3 Hodgman   Moderators   -  Reputation: 31926

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   -  Reputation: 454

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.



PARTNERS