Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
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

Does stretchrect or UpdateRect take out alpha? Please help!

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
2 replies to this topic

#1 Solid_Spy   Members   

708
Like
0Likes
Like

Posted 08 December 2012 - 10:21 AM

This is Directx9, sorry, don't know why it won't let me edit the topic to change the tag -.-

I'm trying to add a surface to another surface, however the alpha doesn't blend, it just shows as white pixels.

For example:

http://i1298.photobu...ha_blending.png

I loaded the HUD surface with LoadSurfaceFromFile, however, i'm not sure if it is loading the alpha or not!

This is the stretchrect code:

d3ddev->StretchRect(tilesurface1, &destrect, backbuffer, &rect, D3DTEXF_NONE);

And this is the LoadSurfaceFromFile code:

d3ddev->CreateOffscreenPlainSurface(1024, 1024, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &tilesurface1, NULL);
D3DXLoadSurfaceFromFile(tilesurface1, NULL, NULL, "Title_Screen_text1.png", NULL, D3DX_DEFAULT, 0, NULL);

I have the backbuffer format set to A8R8G8B8, and also the surface as well, but it still isn't working...

Is there something i am missing? I'm using stretchrect to draw the surface ontop of the backbuffer, is that a bad thing? please help!

Edited by Solid_Spy, 08 December 2012 - 10:32 AM.


#2 MJP   Moderators   

19483
Like
1Likes
Like

Posted 08 December 2012 - 01:53 PM

StretchRect doesn't really "draw" anything, it basically just does a copy. It won't use alpha-blending even if you enable it with blend states.

I would suggest using ID3DXSprite for something like this. It supports blending, and more complex transformations such as rotations.

#3 Solid_Spy   Members   

708
Like
0Likes
Like

Posted 08 December 2012 - 02:13 PM

StretchRect doesn't really "draw" anything, it basically just does a copy. It won't use alpha-blending even if you enable it with blend states.

I would suggest using ID3DXSprite for something like this. It supports blending, and more complex transformations such as rotations.


Hey, thanks for the help Posted Image

I just did some research, and i decided to use 3d quads to draw the images from now on. Sprites are depricated in Directx11, so i feel that it would be a bad habit to learn how to use them in case i wan't to switch to directx11 in the future, but thanks for the suggestion.

Edited by Solid_Spy, 08 December 2012 - 02:14 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.