Post

 Resources 

Console

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

 All Forums
 VBGamer
 VBGamer
 One last DirectX issue - resolutions + TL vertices

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
Almar Posted - May 10 2004 : 2:06:42 PM
Hmm, I still have one annyoing issue that is bothering me a lot. It's in the resolutions changes for YALG. since I'm using Transformed, prelit vertices, I can't simply change the projection matrix to make everything resized. Unfortunatly.

So, I have to recalculate all vertex sizes, and locations. I have simply used the following method for that.

Max resolution, is 1024 is "1".
so, 800x600 = 800 / 1024 = 0.78125

Which is calculated after every resolution change. No problems there. I think this is the right method.

In my function that makes a rectangle triangle list (6 verts), I simply use:

sngWidth = ((sngWidth - 0.1) * constTileSize)
sngHeight = ((sngHeight - 0.1) * constTileSize)

sngX = (sngX * constTileSize)
sngY = (sngY * constTileSize)

the 0.1 is there for demonstration.. I think my problem is related to some rounding stuff, I'm not exactly sure. Well, coming to the problem:



See the black border around the items? Well, at 800x600 it looks like this:


And it's so annoying! At 640x480 the same happens. I have tried Fix/Int/Cint/+0.1/, etc. I know this has been a problem before with the mouse cursor...

anyone have any interesting ideas? :)
15   L A T E S T    R E P L I E S    (Newest First)
Eric Coleman Posted - May 15 2004 : 6:53:17 PM
This this instead... sngY = Int(sngY + 0.5) * ConstTileSize.

Cint is for explicitly specifying the DATA TYPE of a number. The following statements are equivalent, MyNum = 23& : MyNum = CLng(23). Normally VB will use the smallest data type to store a number. The statement MyNum = 23 is really telling VB that the number '23' is either a BYTE or an INTEGER data type, but when the program is run it has to be converted to a LONG data type to fit in the variable MyNum. By explicitly specifying that the number 23 should be used as a LONG number, you save VB from doing an implicit data type conversion.

If you want to take a fractional number, for example, 3.14159 and trim the fractional part, 0.14159, then you would use either Int or Fix. Neither of those functions change the DATA TYPE of the number. For example, if you Dim S as Single: S = 3.14159 : S = INT(S), then NO data type converion is done. The INT and FIX functions are overloaded. Whatever data type you pass IN the function, you get the same thing OUT of the function. Of course, this only works with number data.

INT and FIX only truncate the fractional part of a number. If you want to round a fractional number to the nearest whole number, you can either use the ROUND function, or you can add 0.5 to the number before using INT or FIX. 1.5 should be rounded to 2 by normal mathematical rules. To get a correct answer, use INT(1.5 + 0.5). If you add 0.5 to the number before using INT, then this will work for negative nubmers as well, so you wouldn't need to use FIX. Also, this method doesn't have the same rounding errors as ROUND or CINT will cause.
Almar Posted - May 15 2004 : 03:08:59 AM
Well, still haven't solved it... But the problem still seams to be a bit related t orounding as well..

sngY = (Int(sngY) * constTileSize) \ 1
sngWidth = (sngWidth * constTileSize) \ 1

gives the exit button a "bottom-top", but without, it doesn't.. (Just trying everything that comes to mind)
Peter Posted - May 13 2004 : 1:16:41 PM
Yeah, I've run into this problem before too. Try turning off texture blending when you're resizing the buttons, that fixed it for me, although my borders were a little thicker.
Eric Coleman Posted - May 12 2004 : 5:56:39 PM
This image demonstrates lines being deleted when an image is resized. A good way to see line deletion in action is to quickly create a project in VB, place an IMAGE, not a picture box, on the form in the top left corner, then put image1.height = y : image1.width = x in the form's Mouse Move event. You should be able to move the mouse and interactively change the size of the image and whatch what happens when the image gets bigger and smaller than its original size.

EACam Posted - May 12 2004 : 2:43:32 PM
No...don't give up...just use a different solution
Almar Posted - May 12 2004 : 2:05:10 PM
Hmm, guess not. I thought about changing the destrect of present() but it doesn't work either. Guess I'll give up...
Almar Posted - May 12 2004 : 12:39:38 PM
Hmm, I still think there should be an easier solution.

btw, I was just checking out a new vb fibre test thing I made (making a quick trianglelist rectangle), and I got like 20% speed improvement over the method most people make them. I was totally amazed by the amount of ASM code needed to call just one function..
Sr. Guapo Posted - May 11 2004 : 3:45:19 PM
When you shrink an image, basically, you are deleting lines of pixels (it actually averages 2 together). Anyway, some of the lines will be altered, and it just so happens that your border is being averaged out. In the screen shot, the border is still there, it has just been averaged with the next line(s), so it appears lighter/thinner.
Almar Posted - May 11 2004 : 12:11:59 PM
quote:
Originally posted by Eric Coleman

Are you using texture filtering? If you are, I guess too much of the border is getting cut off for the border to be blended. One option to consider is to design the game for a smaller resolution, and then stretch the graphics to a larger size. The border won't disappear, it will just be a bit blurry.

Or you can do what VBBR suggests, create the border seperately.

A third option would be to use different graphics for different resolutions, but that's an option if you distribute your game over the internet.



This is just an example. It happens to the mouse cursor, or to many other objects... It's some rounding thing, since I can reproduce it with a Cint() in "normal" 1024... it should just be possible to resize the verts. I just don't get it :)
Almar Posted - May 11 2004 : 12:10:34 PM
quote:
Originally posted by VBBR

Hey if the image is a bitmap then... the borders can disappear. look at this...

******
*------*
*------*
******

if you squash this bitmap above to say, half its size look at what will come out probably...

****
*----

oops, that's without my border! Try making the border thicker

You should have know this lesson, try never to squash bitmaps that have a pixelated border... make the border separately.



If you resize a photo, it won't cut something off either.. does it? :). I'm not cutting stuff off.. the TU/TV's stay the same, but the rectangle size is decreased.. it should just work.
ballistik Posted - May 10 2004 : 11:55:11 PM
Ah yes, it took a problem like this for me to learn never to shrink my graphics, only to stretch them, but not too much otherwise that starts to look bad too.
Sr. Guapo Posted - May 10 2004 : 10:32:32 PM
I would use Eric's first idea. You are starting with a big texture, then shirinking it... It may look worse, but it won't be missing pieces if you do it the other way around.
Eric Coleman Posted - May 10 2004 : 7:41:33 PM
Are you using texture filtering? If you are, I guess too much of the border is getting cut off for the border to be blended. One option to consider is to design the game for a smaller resolution, and then stretch the graphics to a larger size. The border won't disappear, it will just be a bit blurry.

Or you can do what VBBR suggests, create the border seperately.

A third option would be to use different graphics for different resolutions, but that's an option if you distribute your game over the internet.
VBBR Posted - May 10 2004 : 5:46:26 PM
of course...
EACam Posted - May 10 2004 : 5:05:53 PM
Oh DUH!!! I was thinking too complicated...i guess that's a programmer's main problem...bugs are often way simpler than we think.

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.