DX8 - 2D kinda problem
ZeroBitHi I recently started using DX8 instead of DirectDraw from DX7 to render 2D graphics. I use DrawPrimitiveUp to print a 2 triangle strip for each image i want to print. I can now even draw only part of an image, which i didnt know how. The problem is, not only the image files must have 2^x dimensions, but so do the part of the image that i print, or it will print badly. So is there any way that I can print a part of an image with the dimensions i want, without getting those strange cuts on the rendered image? It must be possible, because I've seen DX Games doing that (for example the health bar from an RPG, where you have to print the empty bar and then part of the filled bar, depending on the current health). If anyone can help, I'll appreciate much [;)] Thanks
Sr. GuapoWhile it used to be the case with older cards (TNT, Voodoo, etc.), the images do not NEED to be in a base 2 size. However, it is usually a good idea, since it is easier/faster (due to mipmapping, etc.) to follow this format, and it will run on the older cards as well. What kind of graphics card do you have, and what "level" of computers do you want this to run on? To render something to part of an image (if that is what you mean), just change the tu/tv coordinates. I am not sure how to only print part of a texture though, but I know there is a way... sorry... [:)]
ZeroBitWell I can print part of a texture. But when even that part of the texture is not in a base 2 size, it looks like it has been stretched, althogh its the correct size (same effect as i get if i render a holy non-base2 texture) So if i have a 64x64 texture and i print a 16x8 piece of it, it will be accurate, but if i render a 16x7 piece, it will look weird. Oh, if that matters i have a Geforce3 64MB hehe :) thanks for the quick reply :P
masterboodaI have also had the same problem with tearing look, but I use this formula to convert pixels into texels: [code]Public Function CTTC(Total As Single, Current As Single) As Single Dim IncTex As Single IncTex = 1 / Total CTTC = IncTex * Current End Function [/code] Total is the size of the texture, and current is the pixel position on the texture that you want to use, just use this function for every tu and tv on all four corners of the strip. Now if you have tearing when using 16x7, use 16x6.9 or something in that range, I have noticed that using decimal values will usually fix this and keep values from bleeding... I hope this helps... DaBooda Out...
ZeroBitWow Thank you so much. It does work if i add 0.1 I wanted to print a 800x600 image which was inside of a 1024x1024 bitmap file. Now i make it print 800.1 * 600.1 and it prints nice[:0] (my function does the maths to convert to the tu an tv stuff) Anyway thanks alot [:D]