What size do surfaces really have to be?
Do surface widths have to be multiples of 8 or powers of 2? It seems like it varies between different computers. On this computer I think when surfaces are created in video memory the widths have to be powers of 2, but in system memory they can be multiples of 8. Is this true?
Al
Alexbigshot@austin.rr.comFoolish man give wife grand piano. Wise man give wife upright organ.
I think it has to be a multiple of 4, just so that it can be displayed faster or something, but it could be multiples of 8
. (I always due multiples of four, and it works fine)

Powers of two are required for directX everytime, I haven''t read anything that tells me otherwise.
Quoted from "DX7 in 24 hrs":
"Texture dimensions must be a power of two or they will not render and, for all practicle purposes, textures should not exceed 256 pixels in width or height. .... some hardware also requires textures to be square."
I recommended this book for a general overview of the entire DX biz, but anyone want to recommend a book specifically for D3D?
Matt
Quoted from "DX7 in 24 hrs":
"Texture dimensions must be a power of two or they will not render and, for all practicle purposes, textures should not exceed 256 pixels in width or height. .... some hardware also requires textures to be square."
I recommended this book for a general overview of the entire DX biz, but anyone want to recommend a book specifically for D3D?
Matt
Well, I think those rules only apply to textures. I''ve never had any problems with regular surfaces that are strange sizes (maybe I was lucky?
)
--TheGoop

--TheGoop
regular ddraw surfaces(for 2d use) which are only used for blit operations can be any size. maybe ddraw converts them to multiples of some number in vram but it doesnt say that anywhere. i guess you could check what the pitches are of different size surfaces and see. on some hardware they cant be wider than the primary surface.
on the other hand, textures(for 3d use) have to be powers of 2. that not exceeding 256 is because most hardware have a limit of 256x256. only the newer cards support larger textures.
Edited by - trixter on 2/7/00 1:38:05 PM
on the other hand, textures(for 3d use) have to be powers of 2. that not exceeding 256 is because most hardware have a limit of 256x256. only the newer cards support larger textures.
Edited by - trixter on 2/7/00 1:38:05 PM
Carl "trixter"[email=carl@trixoft.com]carl@trixoft.com[/email]http://www.trixoft.com
Actually, that''s incorrect, the majority of hardware supports textures over 256x256. The only series of cards I can think of that cannot are the Voodoo series.
the majority of new hardware...yes.
but not the majority of all 3d cards. not everyone buys the latest video card every 2 days.
do those oem systems with 8mb and 4mb video unified memory support large textures? a lot of people have those now too.
but not the majority of all 3d cards. not everyone buys the latest video card every 2 days.
do those oem systems with 8mb and 4mb video unified memory support large textures? a lot of people have those now too.
Carl "trixter"[email=carl@trixoft.com]carl@trixoft.com[/email]http://www.trixoft.com
The power of two thing is because it is a digital computer.
Everything in a digital computer is recorded as either on or off.
This means 0 or 1.
This is a bit.
One nibble = 4 bits (or is that 4 bytes? I forgot)
One byte = 8 bits
and so forth (char=1b, int=2b, lint=4b ladadadada crap crap crap etc)
Now when you bugger around with textures, it uses a mathematical thing we know as logarithms.
The base that they use is 2.
You could probably change this, but barely anyone has ever bothered. Using the base of 2 is a hell of a lot faster, and why change it if it ain't broken.
Lets say it this way:
You have a texture 64 units in width
program stores the width as log. 2 .64
This is equal to 6
see how much easier it is to store data?
If you are using a calculator (or computer) to test this you will probably have to use the change of base rule to see what I am doing.
log. 2 .64 = (log. 10 .64)/(log. 10 .2)
You get 6.
The computer cycles through this little number to quickly scan through the texture.
If you write your own (or use engines which don't use this method of surfaces) you don't need to worry about the ^2 thing, or you can change it to ^3 or what-ever instead.
A very simple (but probably alot slower) is to draw lots of tiny little flat colour polygons for each pixel in the texture.
Edited by - Veldrik on 2/7/00 8:04:58 PM
Everything in a digital computer is recorded as either on or off.
This means 0 or 1.
This is a bit.
One nibble = 4 bits (or is that 4 bytes? I forgot)
One byte = 8 bits
and so forth (char=1b, int=2b, lint=4b ladadadada crap crap crap etc)
Now when you bugger around with textures, it uses a mathematical thing we know as logarithms.
The base that they use is 2.
You could probably change this, but barely anyone has ever bothered. Using the base of 2 is a hell of a lot faster, and why change it if it ain't broken.
Lets say it this way:
You have a texture 64 units in width
program stores the width as log. 2 .64
This is equal to 6
see how much easier it is to store data?
If you are using a calculator (or computer) to test this you will probably have to use the change of base rule to see what I am doing.
log. 2 .64 = (log. 10 .64)/(log. 10 .2)
You get 6.
The computer cycles through this little number to quickly scan through the texture.
If you write your own (or use engines which don't use this method of surfaces) you don't need to worry about the ^2 thing, or you can change it to ^3 or what-ever instead.
A very simple (but probably alot slower) is to draw lots of tiny little flat colour polygons for each pixel in the texture.
Edited by - Veldrik on 2/7/00 8:04:58 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement