Jump to content
  • Advertisement

Archived

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

Dark Rain

Question about LPDIRECTDRAWSURFACE4

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

I followed a tutorial for Direct Draw and it used exclusively this object to store the surfaces. I noticed it was very fast but I suspect I can make only a limited use of it. What exactly is LPDIRECTDRAWSURFACE4, where is it stored, how many surfaces can I have, is it related to video memory etc. I tried to find info on the subject but since it seem to be a DX4 object ressources were nil. I ask this because I read Real Time Strategy Game Programming using MS directX by Mickey Kawick. Most of the code was very buggy and somewhat weidly put together but there was many optimisations and asm uses, so I assumed that at least it was fast. Well lo and behold, a cheap tutorial I found just blew good ole mickey code away. The thing is, MK doesnt use BltFast or LPDIRECTDRAWSURFACE4 at all. He use customs objects with pointers and such to old all the data, so it's all software and nothing is hardware. It's a pain to handly 16 bits vs 15 bits cards etc. So I was wondering did I learn all of it for nothing or using LPDIRECTDRAWSURFACE4 and BltFast all the way to make a game is a bad idea? If so why? Edited by - Dark Rain on 11/28/00 2:03:29 AM

Share this post


Link to post
Share on other sites
Advertisement
LPDIRECTDRAWSURFACE4 is an older version of the DX surface object. A surface is a plane where you display graphics. The primary surface is what is shown on the screen. You usually have one or teo surface linked to that primary as buffers for doing animation, and you flip between them. Surfaces do take up VRAM (video mem) and you can only create a certain amount of surfaces in VRAM depending on the size of the surfaces and the size of the vRAM. Surface can be spilled over into system memory, but that is very slow (relatively). You can have as many surfaces as you want to my knowledge, but you should try to get rid of old ones you are no longer using. Whooop, class bell''s about to ring Sorry, all I can give you now. Someone''ll come along and fill in the blanks. Oh, and yes, LPDIRECTDRAWSURFACE4 is that way you should program graphics.

==============================
"Need more eeenput..."

- #5, "Short Circuit"
==============================

Share this post


Link to post
Share on other sites
Ok thanks, that confirm my suspicions.

I knew about the back and front buffer, but I cant very well store all my tiles and sprites in video memory right? So I would have to make a very good software blit to compensate for DX one when the VRAM is full which is slow from what I gathered?

Anyone got a good book or website on the subject ^_^. I read 2 full books and searched the net but it seem I bought some really bad books. One claimed to teach DX 7.0 and what da ya know? It use LPDIRECTDRAWSURFACE4 and such all the way.

Share this post


Link to post
Share on other sites
quote:

One claimed to teach DX 7.0 and what da ya know? It use LPDIRECTDRAWSURFACE4 and such all the way.


Hmm... that''s not good

OK, here''s the deal. You''ll want to get all the graphics you''ll be using in the game to fit in the VRAM. Since most cards today now have 32-64MB of RAM, it really isn''t a problem. Except you still have to be consciencous of those low-end users - they will always exist. DirectDraw can Blt() from both VRAM and system RAM, you don''t need your own blitter, it won''t speed things up. Or if it does, the performance gain will be practically nil. In fact, you can decide when you create an offscreen surface (one not in the flipping chain and used to store bitmaps and such) whether to store it in VRAM or SRAM. Default is VRAM of course but if you have graphics that are only loaded once say, in the beginning of the game, I''d put them in SRAM. Sure, it may take slightly longer for the game to load but then you have more VRAM for storing objects that appear a lot and change a lot during the game. Always be sure to include a function that checks graphics in and out of VRAM so you don''t overflow.

And the best book for learning DirectX would have to be Andre LaMothe''s Tricks of the Windows Game programming Gurus. Go to the books section on this site for a link to Amazon.com. Andre''ll get you right off into DirectX. Unfortunatly, he uses DirectX 6, which uses the LPDIRECTDRAW4 objects. DirectX 7 uses LPDIRECTDRAW7 (what happened to versions 5&6? No one knows... I guess people started getting confused as to why DX6 had a surface object in version 4 ) But since all DX is backwards compatible, learining to use the DX 7 object is easy once you get the basics down. Good luck

==============================
"Need more eeenput..."

- #5, "Short Circuit"
==============================

Share this post


Link to post
Share on other sites
"what happened to versions 5&6? No one knows... I guess people started getting confused as to why DX6 had a surface object in version 4" -- Gaiiden

Gaiiden,

What happened is they just didn''t update the surfaces in 5 and 6. Why should they change EVERYTHING with every release? They it it pretty much with DX8 and it''s a pain in the ..., don''t you agree??

------------------------
CRAZY_DUSIK* pCrazyDuSiK;
pCrazyDuSiK->EatMicroshaft(MS_MUNCH_BILL_GATES | MS_CHEW_BILL_GATES);

Share this post


Link to post
Share on other sites
true, true.

But you have to admit, I remember a lot of posts about why the DirectDraw object was only in version 4 when DirectX was in version 6. It just didn''t seem right to people who thought of DirectX as a whole unit, not one that''s broken up into parts.

==============================
"Need more eeenput..."

- #5, "Short Circuit"
==============================

Share this post


Link to post
Share on other sites
Actually, the DirectX interfaces used to increase linearily
in number when there was an update and not linearily when there
was a new version of DirectX.
But many people probably got really confused as to why you use
IDirectDrawSurface4 and IDirect3D3 when using DirectX 6.
For newer versions they renamed the interfaces to more logical
names like IDirectDrawSurface8 and IDirect3D8 to make it
a little more convenient...

Why does MS need 8 versions to get something right? ;-)

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!