Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 DX8 - 2D kinda problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ZeroBit
Neophyte

3 Posts

Posted - Jun 08 2004 :  9:16:49 PM  Show Profile  Reply with Quote
Hi
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

zb

Sr. Guapo
Swordmaster

USA
272 Posts

Posted - Jun 08 2004 :  9:44:20 PM  Show Profile  Reply with Quote
While 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...

Go to Top of Page

ZeroBit
Neophyte

3 Posts

Posted - Jun 08 2004 :  9:59:25 PM  Show Profile  Reply with Quote
Well 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

zb
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - Jun 08 2004 :  11:13:35 PM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
I have also had the same problem with tearing look, but I use this formula to convert pixels into texels:
Public Function CTTC(Total As Single, Current As Single) As Single
Dim IncTex As Single
IncTex = 1 / Total  
CTTC = IncTex * Current  
End Function
  


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...

DaBooda Team is back: http://dabooda.789mb.com/
Go to Top of Page

ZeroBit
Neophyte

3 Posts

Posted - Jun 09 2004 :  1:31:57 PM  Show Profile  Reply with Quote
Wow 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

(my function does the maths to convert to the tu an tv stuff)

Anyway thanks alot

zb
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.11 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.