Square outline rotating images

BlitzMax Forums/BlitzMax Programming/Square outline rotating images

(tu) ENAY(Posted 2006) [#1]
Does anyone know how to get rid of those weird faint outlines you get on the outline of your image size when you start rotating and scales your images?

I've noticed this doesn't seem to happen when using the DIrectX driver, just the OpenGL one, does anyone else get this?


assari(Posted 2006) [#2]
could be related to this loadanimiamge problem on OpenGL


tonyg(Posted 2006) [#3]
Have you got any example code as I haven't noticed a problem but can't understand your first sentence.


(tu) ENAY(Posted 2006) [#4]
Ok, look here.



I'm loading a star image (png), on the pic it's rendering as 0.5,0.5 scale and rotating constantly. WHen it rotates a faint white square outline flickers as it rotates.

This does not happen when using DirectX.

If you can't see it, turn up your monitor brightness or invert the image's colours.


ragtag(Posted 2006) [#5]
Have you tried different settings flags for LoadImage, filtered, mipmapped etc.


Dreamora(Posted 2006) [#6]
*and have you checked your driver settings if OpenGL wasn't set to min quality while DX is on high or something like that.


Grey Alien(Posted 2006) [#7]
I think the protogem author had some problem like this early on...


tonyg(Posted 2006) [#8]
Can your example code and post the image without the lines?


(tu) ENAY(Posted 2006) [#9]
I'm using mipmap, filtering and transparency.

You can use any image, just load one using the above.
Scale it to 0.5,0.5, rotate it and then bingo, you should see the lines.

Although it does seem to be harder to see on certain coloured backdrops/images.

Happens on both my PCs os varying specs and gfx cards.


Rimmsy(Posted 2006) [#10]
Might this help?

http://blitzbasic.com/Community/posts.php?topic=59226#660751


GfK(Posted 2006) [#11]
I get this too when using GLMax2DDriver() only. I wrote a bitmap font routine last night and noticed this problem - thought it was something to do with my code.

I'm not rotating images. Just scaling them is enough to cause it.

Might this help?

blitzbasic.com/Community/posts.php?topic=59226#660751

Nope. Seems to be the MIPMAPPEDIMAGE flag that's causing it here. Not using that flag makes everything look crap, though.

[edit] If anybody wants to see this bug in all its glory - load Birdie's Zombieblast demo from the code samples that install with Blitzmax, and insert SetGraphicsDriver GLMax2DDriver() somewhere near the start. The player ship has a very visible box around it.

This definitely needs to go in bug reports, enay.


(tu) ENAY(Posted 2006) [#12]
> This definitely needs to go in bug reports, enay.

Heh, well I didn't even realise it was a bug.
I'd move this into bug reports if I could :)

[edit] Oh wait, you mean make a NEW topic. Silly me.


xlsior(Posted 2006) [#13]
Is the size of the image even, or odd?

If odd, you may see some weird things when using automidhandle, since it will try to draw things at a half-pixel boundary


GfK(Posted 2006) [#14]
If odd, you may see some weird things when using automidhandle, since it will try to draw things at a half-pixel boundary
Umm... no. Firstly there's no such thing as half a pixel. Second, if an image is, for example, 5 pixels wide, the centre of the image would be the third pixel across, with two pixels either side.

Image size doesn't cause/rectify the problem anyway. Its caused exclusively by MIPMAPPEDIMAGE in GL only with scaled images. Try Birdie's Zombieblast demo in GL (it used DX by default). In fact, everyone should try it - just to rule it out as a card-specific issue.


(tu) ENAY(Posted 2006) [#15]
Well it happens on both my PCs that have different gfx cards. So it's very likely not to be gfx card.

Besides I'm using even numbered images, odd numbered image sizes just make the image come out all blurry.


Robert Cummings(Posted 2006) [#16]
Don't get confused. In a 3D engine you have sub-pixel accuracy, and floating point movement. The image is filtered if you are at a floating point position.

I however respect that this isn't the problem you're experiencing. I think there's a couple of gl mip map issues. One of them I found is with filtering and loadanimimage.


GfK(Posted 2006) [#17]
I've just checked this problem on my laptop with a cruddy on-board Trident Cyberblade 16mb graphics card with no GL support.

It drops into software mode and I do not get any problems at all. Looking like its a hardware GL issue.


Defoc8(Posted 2006) [#18]
hmmm, are the textures clamped? - i havent looked at the
max2d opengl src, but perhaps this could be resolved by
clamping textures if they are not already clamped? - having
said that, i dont get this effect..so its possibly a driver
problem.

heh..jst checked it is clamped - i cant see from the texture
handeling code what might be wrong - looks fine to me.


fredborg(Posted 2006) [#19]
Try changing the GL_CLAMP_TO_EDGE in lines 85 and 86 of glmax2d.bmx to $2900 (for GL_CLAMP), to see if that fixes it.

Or commenting out the two lines completely to see if that helps.

ie:
	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,$2900
	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,$2900
or:
'	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE
'	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE
If either of these solutions work for you, it should be easy to add a check to see if GL_CLAMP_TO_EDGE is supported by your graphics card.