Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

Direct Draw Fault

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

#1 Spike   Members   -  Reputation: 122

Posted 25 January 2000 - 05:40 PM

Something that I have known about for a very long time is the fact that direct draw surfaces must be divisible by 8 in there size. As much as I have learned to live with this, it still bugs me at why this is so. If anyone knows, please tell me about it. Any help apreciated Spike


#2 CGameProgrammer   Members   -  Reputation: 640

Posted 25 January 2000 - 06:37 PM

I''m pretty sure they simply need to be a power of 2, so each side must be 2, 4, 8, 16, 32, 64, 128, 256, 512, or 1024. The actual range of allowed sizes may be different than 2-1024; I''m just guessing.

Anyway, this is done with many engines to make calculations faster; bit shifting is faster than multiplication and much faster than division. An example of shifting power-of-10 numbers is left-shifting 1000.300 to make it 10003.00; left-shifting it one time is the same as multiplying it by 10^1. Computers use binary math, so left-shifting a number x number of times (number << x)is the same as multiplying it by 2^x. Right-shifting a number x times (number >> x) is the same as dividing it by 2^x.

~CGameProgrammer( );

#3 mason   Members   -  Reputation: 128

Posted 26 January 2000 - 05:46 AM

It might also have something to do with the fact that Intel machines like to deal with things on a 4-byte basis (memory alignment).

Mason McCuskey
Spin Studios - home of Quaternion, 2000 GDC Indie Games Fest Finalist!

#4 Spike   Members   -  Reputation: 122

Posted 26 January 2000 - 10:32 AM

Thanks guys.

cprogrammer(), i think your right.

mason, even though what you say might be the case, I don't think so.


Edited by - Spike on 1/26/00 4:34:12 PM

#5 BINS   Members   -  Reputation: 122

Posted 26 January 2000 - 10:40 AM

I think Mason is correct


#6 Facehat   Members   -  Reputation: 696

Posted 26 January 2000 - 01:00 PM

Maybe I''m crazy, but I''ve never had any problems with Surfaces that aren''t powers of two. I''ve had surfaces of all sizes without any problems.

I do know for sure that textures need to be powers of 2. Is this what your refering to?


#7 Spike   Members   -  Reputation: 122

Posted 27 January 2000 - 11:52 AM

To theGoop,

I am refering to surfaces. Try and build a surface that is 19 by 19. Then watch as your program totally messes up the images and anything else you may be trying to write to the surface. It is also possible for it to perform an illegal operation.


#8 Bigshot   Members   -  Reputation: 122

Posted 27 January 2000 - 12:05 PM

When I''ve created surfaces... in my experience... they''ve only gotten garbled when they were in video memory, but in system memory they always seem to work right no matter how large they are. Why? I don''t know.


#9 SeanHowe   Members   -  Reputation: 142

Posted 27 January 2000 - 12:11 PM

Well, what version of directdraw are u using? DDraw 7 surfaces work fine for me no matter what their sizes...

#10 Spike   Members   -  Reputation: 122

Posted 28 January 2000 - 01:09 PM

I am using DX 5. So if you are using DX 7, microsoft have probably already fixed up the problem.


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.