What does HiTech know to which he is looking for the return of 16, 32, 128, 256, 512, 1024 as specific responses opposed to sampling for all text images between "0" and "1024"? Is it to account for end user fat fingering when creating the milrad size text file data entry? --Or-- Is the function looking for those specific responses a very simple and elegant entity which needs only those 6 responces opposed to parsing everything between 0 and 1024 in each text file? After all we can only black box the COAD in this post looking for the 6 responses. We have absolutly no clue if it is a real part of the game COAD or HiTech chatting with a freind in a casual moment.
Seems like something my assembley language teacher used to ding me over.
HiTech is looking for images with widths that are a power of 2. Traditionally a lot of graphics platforms required the width of a texture to be a power of 2. This is mainly for performance and silicon reduction reasons. For example, when the hardware indexes into the texture to retrieve a texel, it would have to convert a 2d coordinate (u,v) to a 1 dimensional memory address. The formula for finding this is...
(texture_width * v + u) * texture_bit_depth + texture_start_memory_location
Now what does that have to do with widths that are a power of 2? Well, if the width is a power of two a 'bit-shift' to the left can be used instead of a multiplication operation which is faster and requires less silicon to do. AKA
2<<1 = 2 *2 = 4
or
2<<2 = 2 *4 = 8
Also you could 'cap' and 'wrap' texture u values and force them to be within the bounds of the texture with simple boolean operations such as 'and'.
texture width = 32
/* force texture u coordinate to wrap */
u = u&(width-1);
Now of course there are many more reasons hardware designers chose this option beyond just texel indexing but the short answer is that historically textures had to be widths of powers of 2.
I don't know that much about DirectX, but I know that there are extensions to OpenGL which support non-power of 2 texture widths... aka GL_ARB_texture_non_power_of_t
wo is one that comes to mind.
Another option would be wasteful of memory but a non-power-of-2 width texture could be blited into a larger power-of-2-texture then the corresponding texture coordinates on the mesh could be updated to point to the correct locations in the texture.
Ok HiTech, now its your turn to attempt to lambast me on the BBS as I know your itching too.