Graphical issue

BlitzMax Forums/BlitzMax Programming/Graphical issue

Eikon(Posted 2006) [#1]
I've run into a problem that seems to only affect OpenGL. Certain images in my game have lines at their edges. It may be hard to notice, but look closely and you'll see the OGL render has gray lines in between the gems.



I don't get this using the same image with D3D. The gems are drawn at Int positions and are scaled from 36x29 by .8, .8. It is also happening to other images throughout my game. It's not a major problem because I default to D3D and tell the user it's preferred, but it would be nice to have both working correctly. The gems are loaded as an AnimImage with masked, filtered, and mipmapped flags. Any ideas?


N(Posted 2006) [#2]
Probably an issue with downsampling, lack of clamping, or the texture border (not in the image).

Given that it's barely visible, I'd just ignore it.


Eikon(Posted 2006) [#3]
I would, but it becomes painfully evident against a light background. The whole playing field begins to look like a grid.


N(Posted 2006) [#4]
Well then I'd advise you either wait for a fix or get familiar with OpenGL and modify GLMax2D.

Probably the best places to look are the function to resize pixmaps and glTexFromPixmap.


Eikon(Posted 2006) [#5]
Guess I'll wait.

Thanks, Häm.


xlsior(Posted 2006) [#6]
- Make sure you use integers and not floats to position your images, otherwise you may not be drawing your sprite exactly at a pixel boundary, which can result in some unexpected blending
- If using midhandle, make sure that your sprites are an even (not odd) number of pixels in size, or it too can lead to getting drawn in the middel of two pixel boundaries, leading to blending.

It may also be a setting in your video drivers... I've seen this happen with a program I wrote as well, works OK without lines on two of my computers, but on a 3rd I see the lines. (Acutally... I guess that could also mean that changing the DirectX video mode failed, and it fell back to OpenGL on that box)


Dreamora(Posted 2006) [#7]
As well, make your textures power of 2 square, otherwise they will have black borders around them (filling up to the next power of 2 square) which perhaps are causing the issues when you scale with a value that does not exist as float (like 0.2 / 0.8)


TartanTangerine (was Indiepath)(Posted 2006) [#8]
BMAX will increase the size of the individual images (in AnimImage) ^ 2, maybe that's your issue.

{EDIT} It won't resize the image, it will add blank pixels.

{EDIT} My AnimImageFast Module should sort this for you (unless you are already using it :D)