About Monkey 2 › Forums › Monkey 2 Programming Help › Image Filtering
This topic contains 7 replies, has 6 voices, and was last updated by 
 ImmutableOctet 2 years, 8 months ago.
- 
		AuthorPosts
 - 
		
			
				
July 24, 2016 at 6:59 pm #2397
I’ve noticed that images rendered in monkey2 seem a little more blurry then I’m used to like there’s too much filtering going on. I’ve tried with and without the filter and mipmap flags when loading the image but it doesn’t seem to make any difference. Also setting TextureFilteringEnabled to false on the canvas doesn’t seem to make a difference either. See below for image to compare with Blitzmax which I think looks a lot better and “cripser”. You may not think there’s much difference but it is quite apparent to me
(left is monkey2)

Is there anything I can check or try to get things looking more crisper?
July 24, 2016 at 7:06 pm #2398TextureFilteringEnabled set to false should make a huge difference. You need to call it at each render though.
July 24, 2016 at 8:53 pm #2400I have nice crispy particles again, I found the reason but I’m still a bit confused. I have a function to load a sprite with frames of animation:
Monkey1Function LoadFrames:Image[] (path:String, numFrames:Int, cellWidth:Int, cellHeight:Int, padded:Bool = False, flags:TextureFlags = TextureFlags.Filter|TextureFlags.Mipmap, shader:Shader = Null)So if I call that function with:
Monkey1shape.image = tlShape.LoadFrames(url, frames, width, height, flags)Where flags is set to “TextureFlags.Filter” only, it seemed to just go ahead and assign both flags anyway, which is odd, I’m not sure why as it gets overridden properly inside the mojo lib.
So I’ve fixed it to just set one filter by default:
Monkey1Function LoadFrames:Image[] (path:String, numFrames:Int, cellWidth:Int, cellHeight:Int, padded:Bool = False, flags:TextureFlags = TextureFlags.Filter, shader:Shader = Null)July 24, 2016 at 9:25 pm #2401I have had issues with monkey2 flag handling on Pi. I wonder if they are related.
This code gives different output on Mac and Pi (b=1 on Pi).
Monkey1234567891011121314enum BitsOne=1Ugly=$80000000endfunction Main()print "hello"print int(Bits.One)print int(Bits.Ugly)local a:=Bits.Onelocal b:=(a&Bits.Ugly)<>nullprint bEndJuly 25, 2016 at 1:31 am #2411This might be a case of OpenGL library issue (changing the texture state somewhere).
(search something like: SDL textures appear blurred)
https://www.opengl.org/discussion_boards/showthread.php/166337-Blurred-textures-need-it-sharp
July 25, 2016 at 1:50 am #2412> shape.image = tlShape.LoadFrames(url, frames, width, height, flags)
You’re missing the ‘padding’ param. Should implicit enum->bool be disallowed?
If that’s not it, can you post the lib code?
July 25, 2016 at 8:24 am #2421You’re missing the ‘padding’ param. Should implicit enum->bool be disallowed?
Doh! That was the reason, can’t believe I missed that! I should know by now to look for the obvious thing first, thanks
July 25, 2016 at 8:43 am #2422@Mark Sibly: Yeah, that may be a wise choice.
Although, I really have to question why enumerators can even be implicitly casted to integers. It can’t be done the other way around, so shouldn’t you have to add an explicit cast here as well? That would kill two birds with one stone.
 - 
		AuthorPosts
 
You must be logged in to reply to this topic.