![]() |
|
OpenLayer border issues |
Billybob
Member #3,136
January 2003
|
I think this may have been brought up before, but I don't remember the solution. I'm doing a tilemap in OpenLayer 1.92. When the "camera" first shows up it's at 0, 0. The Camera thus sets Transform::SetPosition to 512, 384. Now when I scroll the map a little bit I get a grid effect. See the attachment's bottom picture. I'm assuming this puts the camera at a non-integer position and causes the blits to end up at weird places. The grid effect goes on and off as I scroll.
Bitmaps are 100x100 PNGs with no alpha (except for what OpenLayer adds).
|
Fladimir da Gorf
Member #1,565
October 2001
![]() |
In fact those borders are actually translucent lines. The issue comes from OpenGL's way to render the quads and is "fixed" in OL2.0 so that the borders don't appear. To fix that you could make the Bitmaps one pixel wider and high than supposed (by copying the last row and column) and then rendering those in a reversed order. An another (and better) way would be to compile OpenLayer again with the fix, but unfortunately I've split the image loading and rendering to several parts behind the scenes to allow OpenLayer to work easier with SDL, for example. I've changed so much that I don't remember which changes were important for the fix anymore... This is the relevant code and should be placed in the Load-methods right before SendToGPU. It might not be enough, though.
PS. I'd be better if 2.0 would be ready already, but it doesn't still feel complete to me. And to consider that originally it was only going to be a really small update... EDIT: Tried to make it clear that the old Bitmap API isn't going to change. OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
Billybob
Member #3,136
January 2003
|
Quote: To fix that you could make the Bitmaps one pixel wider and high than supposed (by copying the last row and column) and then rendering those in a reversed order. Could you elaborate?
|
Fladimir da Gorf
Member #1,565
October 2001
![]() |
The problem is that the last row and column are both translucent because the invisible translucent parts in the right and bottom side of the Bitmap are blended with the opaque pixels in the edges (or so I think): _____________ |visible | | | image | | |________| | | invisible | | borders | |_____________| A Bitmap with exaggerated borders Those borders exist to make the dimensions of the Bitmap powers of two. Some hardware support non-power-of-two images and those are supported in OL2.0 (once again However, in usual hardware when you render the image at subpixel coordinates the borders of the image aren't clipped properly if there's borders around the image. To prevent that, make the Bitmap one pixel wider and higher than it's supposed to be. Then render the tilemap so that you can't see any overlapping - thus you need to render the tilemap from bottom to up, right to left. OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
Billybob
Member #3,136
January 2003
|
Quote: you need to render the tilemap from bottom to up, right to left. Naw, no need for that. Just changing the line to: Thanks for the help.
|
|