One last DirectX issue - resolutions + TL vertices
Almar JolingHmm, 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: [img]http://vulcanus.its.tudelft.nl/~unreal/sponge/probyalgshot1.jpg[/img] See the black border around the items? Well, at 800x600 it looks like this: [img]http://vulcanus.its.tudelft.nl/~unreal/sponge/probyalgshot2.jpg[/img] 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? :)
VBBRWow how many annoying issues have you come into since you started this game? [:P] Sorry I don't know what the problem is. But a guess... How do you calculate the button border thickness?
Almar Joling
quote:
Originally posted by VBBR
Wow how many annoying issues have you come into since you started this game? [:P] Sorry I don't know what the problem is. But a guess... How do you calculate the button border thickness?
just a bitmap :)
EACamit looks like a problem with the texture coordinates... What was that 0.1 for again? I don't get why you'd need it... If i were you, i'd simply calculate the scale factor (for both height and width) between the display mode you made the game for and the display mode you're using and then multiply all the tiles/graphics by that...if that's not what you're doing already [:)] Edit: Oh, yes it looks like you're doing the scale factor, but are you doing it for BOTH the height and width? You have to. And you should just multiply ALL values by the scale factor (which, obviously, would be 1 if the display mode was at the default). E.g. VertexCoordinate(X * ScaleFactorX, Y * ScaleFactorY)
Almar JolingI'm doing that.. and the texture coords don't change.. The 0.1 is just for rounding purposes.. it was a test ;)
VBBRHey 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.
EACamOh DUH!!! I was thinking too complicated...i guess that's a programmer's main problem...bugs are often way simpler than we think. [:)]
VBBRof course... [:D]
Eric ColemanAre 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.
Sr. GuapoI 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. [;)]
ballistikAh 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. [:p]
Almar Joling
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.
Almar Joling
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 :)
Sr. GuapoWhen 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 JolingHmm, 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..
Almar JolingHmm, guess not. I thought about changing the destrect of present() but it doesn't work either. Guess I'll give up...
EACamNo...don't give up...just use a different solution [;)]
Eric ColemanThis 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. [img]http://www.vbgamer.com/msgboard/uploaded/Eric Coleman/2004512175240_lines.gif[/img]
PeterYeah, 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.
Almar JolingWell, 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)
Eric ColemanThis 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.