DIB or DDB

Started by
6 comments, last by rangler 19 years, 10 months ago
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()?
//My SignatureString sig = "Rangler";System.out.println(sig);
Advertisement
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/
- fyhuang [ site ]
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.
//My SignatureString sig = "Rangler";System.out.println(sig);
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
Evillive2

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
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
Sincerely,Randy Trulsonwww.NeuronGames.com
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.
//My SignatureString sig = "Rangler";System.out.println(sig);
Try CreateDibSection(...)

This topic is closed to new replies.

Advertisement