This second problem is recent, and it's VERY weird. Ok, I was testing my ability to make a nice interpolated sun-set sky in the background, so I stretch a 1x1 white pixel on the screen and color blend the sides to get my sky. It looks quite nice actually. However, it get's very messed up during a very specific circumstance in my game (which is a 2D side scroller). When I'm moving my little guy around on the floors (currently all one texture, I'm not done with the graphics) the sky simply sits in the background unintrusively. But, when I let my guy fall in a part of the map in which NO tiles are being drawn (just the background and him) the background suddenly becomes a large colorized, stretched floor texture and my guy disappears!Screenies:Regular (notice the background gradient):[img]http://www.vbgamer.com/msgboard/uploaded/Iodiplin/20041025164315_good.JPG[/img]Messed Up (notice the same background gradient, applied to the wrong texture): [img]http://www.vbgamer.com/msgboard/uploaded/Iodiplin/20041025164439_bad.JPG[/img]I've tried setting the rendering texture to nothing and setting it back again; doesn't work. I can't think what could be going wrong, cuz' when I go back to an area with tiles again, it works fine, so it's not like it's loosing any data! [}:)]Thanks in advance.">
Strange Problems in DX8 | |
Iodiplin | I've got two problems here (seems I've had lots of those recently) both with DX8.
The first is a little more straight forward than the other, so I'll give that one first.
When I go from windowed mode to full-screen mode (by changing the presentation parameters and resetting) it works just fine. When I switch between full-screen mode to windowed mode it also works fine...almost. In the latter case, the windowed form becomes COMPLETELY enveloped by the rendering, therefore the title bar and its contents are not visible, they're being drawn on. The only way I can seem to fix it is by minimizing the window (only accessable by the task bar button) and then restoring it again. Even by doing this, somehow the size of the render target gets smaller so things are being chopped off at the bottom and right edges (like the FPS counter text, at first I thought it was saying I had an FPS of 9, but it was because the 2 was cut off, so it was actually 92).
Screenie after going back to windowed mode:
[img]http://www.vbgamer.com/msgboard/uploaded/Iodiplin/20041025164742_weird.JPG[/img]
I can't understand why this is happening, because it looks fine when I initialize right into windowed mode.
Hopefully someone will have experience here to point me in the right direction. (I've tried everything [:(!])
This second problem is recent, and it's VERY weird. Ok, I was testing my ability to make a nice interpolated sun-set sky in the background, so I stretch a 1x1 white pixel on the screen and color blend the sides to get my sky. It looks quite nice actually. However, it get's very messed up during a very specific circumstance in my game (which is a 2D side scroller). When I'm moving my little guy around on the floors (currently all one texture, I'm not done with the graphics) the sky simply sits in the background unintrusively. But, when I let my guy fall in a part of the map in which NO tiles are being drawn (just the background and him) the background suddenly becomes a large colorized, stretched floor texture and my guy disappears! Screenies: Regular (notice the background gradient): [img]http://www.vbgamer.com/msgboard/uploaded/Iodiplin/20041025164315_good.JPG[/img] Messed Up (notice the same background gradient, applied to the wrong texture): [img]http://www.vbgamer.com/msgboard/uploaded/Iodiplin/20041025164439_bad.JPG[/img] I've tried setting the rendering texture to nothing and setting it back again; doesn't work. I can't think what could be going wrong, cuz' when I go back to an area with tiles again, it works fine, so it's not like it's loosing any data! [}:)] Thanks in advance. |
VBBR | Have you tried putting a DoEvents before the Reset call? |
Iodiplin | Yes...it didn't work. |
Eric Coleman | The first problem is obvious, but a fix for it is't. What's happening is that you're intializing directx to use the form's drawable area before the operating system gets a chance to define the masked areas where the title bar and windows border should be. It may not work but its something to try, use a picturebox for rendering when in windowed mode. Also, what event are you using to call the re-intializing code for directx? DoEvents is probably not working for you because your event isn't finished, so other events may not execute because they need the uncompleted event to finish first. For the second error, I'm not sure. It's possible that you're calling a render function with no vertices, and I think that behavior is undefined. Since there are no tiles on the screen, your tile data should be empty right? If that's the case, then you shouldn't even call the render function. Directx might be getting bogus data from memory and rendering leftover information. |
Iodiplin | Thanks. I'll see if I can't put the DoEvents somewhere else and ensure the OS finishes chaning the screen resolution before reassigning the render target. As for the second, I think you may be right. I'll have to experiment more with it. Perhaps it actually isn't setting up the verts correctly for the sky but it doesn't cause a problem when other things are being renderered. ??? Notice that the messed up background is using the wrong texture, but it appears the texture (floor texture) isn't actually being drawn correctly (as if I wanted it drawn). It 's a bit too beig for the scren. Of course, with a mere gradient, you wouldn't notice that, but with the texture, it's more apparent. Dunno. I'll post my results. Thanks again! |