Archived

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

DIB or DDB

This topic is 4967 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, in my current project I am using the GDI for graphics. My question is which is faster to draw a DDB or a DIB? Also I want to access the pixels directly to edit them, would it be worth my time to write a algorithm to copy pixels to a buffer? Could this algorithm possibly be faster than BitBlt()?

Share this post


Link to post
Share on other sites
I would really suggest that you not use GDI. It is SLOW. If you don''t need the speed, you shouldn''t worry about whether DIBs or DDBs are faster. If you don''t HAVE to use GDI, try nehe.gamedev.net to learn OpenGL.


-- Fyhuang, president, Altitude Technologies

Altitude Technologies: http://www.hytetech.com/altitude
Altitude Forums: http://s8.invisionfree.com/Altitude_Forums/

Share this post


Link to post
Share on other sites
it is currently impossible at the moment due to the restrictions of my computer to use an advancced graphics library. Any help with my questions would be useful.

Share this post


Link to post
Share on other sites
If I remember correctly a DDB is blitted faster to the screen than a DIB. Why it is faster I don''t remember exactly but it might be because no conversions have to be made as far as pixel format? Don''t kill me if I am wrong, it has been a while since I have used GDI. I am a recent convert to SDL but I won''t tell you to switch However, on individual pixel operations, were you to write your own functions to do so could come out faster than GDI''s existing GetPixel and SetPixel functions but would take development time. The time spent reinventing the wheel could be a learning experience depending on how much effort you want to put into it.

GDI does have its good sides though. One of the great things about dealing with GDI is that no matter the screen resolution (not sure if this applies to palletized mode) you can safely work with 24 bit colors and let GDI do all conversions for you. Figuring out 16 bit color cand be a real pain. I happen to be of the opinion that doing a few small projects to familiarize yourself with GDI is a good thing.


Evillive2
E-Mail

Share this post


Link to post
Share on other sites

You haven''t mentioned what platform you''re using, but the general answer for GDI is that DDBs are faster than DIBs.

If your platform has any video acceleration, the blts can be done in video memory. I don''t see how you could write something faster in that case. Beyond that...

You might want to check out some of the articles and resources on this site for PocketPC. Some of the people programming to that platform have had plenty of experience using "GDI with limitations."

Cheers,

Facet

Share this post


Link to post
Share on other sites
In my humble opinion, if you have a Pentium 2 of faster, the GDI is so freaking slow relative DirectX that you could use either DDB or DIB and I seriously doubt you will actually see a speed difference between the two. The GDI is going to be the major bottle-neck in the speed.

However, if I have to use the GDI I always use DIBs. It is just easier to deal with in the end, and if you ever wanted to convert your program to DirectX, it is one less thing to worry about :D



Sincerely,
Randy Trulson
www.GamePotato.com
www.NeuronGames.com

Share this post


Link to post
Share on other sites
I am working with the GDI because I am building my little game at my HS and they have deepfreeze which basicly means that nothing can be writen to the local hard drive. Basicly what I wan''t to acomplish is a double buffered rendering system that uses DIB so I can have direct access to pixels and am able to manualy copy them to the buffers. Also I am trying to learn vc++6 inline asm and had planned to use it for copy operations. Thanks for all your tips & advice.

Share this post


Link to post
Share on other sites