Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Askadar

Using Transparency in DDraw with software

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

Hi! I''ve been reading about transparency in direct draw and know that I have to implement it in software. I read the articles here, so I basically know how to implement it, but there''s one question that I''ve got: I read that getting pixels from VRAM is really slow, because the video cards are built for blitting, not getting data. So all the tuning in the world won''t help if you''re trying to blit something transparent onto the primary surface, right? Or is this a wrong assumption and it doesn''t matter? In case I''m right, that would mean that one would have to prepare the frame in system memory and one would loose all the advantages of the blitter and surface flipping. Right? Or again wrong? Thanks for you help!

Share this post


Link to post
Share on other sites
Advertisement
Yes reading to/from video memory is very slow.

If you plan to use a lot of alphablending it is best to blit to an offscreen system surface and when you are done blit it to your backbuffer and then flip.
This means that all your surfaces should be kept in system memory even though you don''t plan on using them all for alhablending.

Share this post


Link to post
Share on other sites
Isn''t there a way to get around this, or this there no difference (for the framerate, say I lock it to 30 fps anyway) on modern computers whether the frame is created in VRAM or system memory anyway?

Share this post


Link to post
Share on other sites
The VRAM will blt your images much faster than in the system memory, since this is what is VRAM was meant for. Also, copying the memory into the VRAM will be slightly costly.

Though even with that in mind, as mentioned before, it is much quicker than retreiving pixel information from the VRAM.

Gamedev''s AI Auto-Reply bot.

Share this post


Link to post
Share on other sites
Now if I prepare the frame in system memory and do a whole lot of alpha blending at 32 bpp, what kind of processor requirements should I expect?

If I have only one 800x600 surface, that I want to fade in and out, will that be doable for old 400Mhz AMDs?

Share this post


Link to post
Share on other sites
nope. unless you use 8bit color with mmx asm, even then you are streching it. your ram is just not fast enough to handle that. if you want to do fullscreen alphablending or a lot of alphablending at high resolution, use d3d or opengl. you still do the game in 2d, but use textured quads instead of sprites. now you get bilinearing zooming, alpha blending, depth buffering, all for virtually no cost (well the video card has limitaions to, but 3d accelerators have much more bandwidth/better designed to handle this stuff). the only true way to know is to actually see for yourself. you may surprise yourself and find the framerate accpetable. but dont expect anything north of 15frames per second (and thats being optimistic).

Share this post


Link to post
Share on other sites
no, i'm pretty sure you can use transparency in directdraw...
look up "color key" in the docs (or search gamedev.net forums)...
--- krez (krezisback@aol.com)

Edited by - krez on December 14, 2001 7:23:21 PM

Share this post


Link to post
Share on other sites
Yep, I meant translucency.

So If I just want to fade my background in and out, it might me a better way to just prefade it in Photoshop and load all the frames for a 2 second fade in/fade out. That would of course eat up a whole lot of memory, but at least I would get it to run smoothly.

I''m just learning these things now, so I''m a little bit scared about D3D8, because it looks, well, very complex at least....

Thanks a lot guys for your help!

Share this post


Link to post
Share on other sites
Ups. Just did a little calculation, it would eat a lot more than just a few megs.... Well, maybe I have to look at D3D anyway...

Share this post


Link to post
Share on other sites

  • 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!