Image filtering and full screen

Monkey Targets Forums/Desktop/Image filtering and full screen

David Casual Box(Posted 2014) [#1]
Hi there,

I'm making a game with pixel art (with very small 8x8 sprites). I need to turn of the image filtering with Mojo. I'm targeting desktop (glfw).

Despite being able to remove image filtering on windowed mode, the filtering is still here when I activate the fullscreen mode...

Here is the capture:

https://www.dropbox.com/s/7tcqz5ws3pil10u/Capture%20d%27%C3%A9cran%202014-09-23%2012.40.42.jpg?dl=0

Here is my code working (no image filtering, no anti alias):
#GLFW_WINDOW_FULLSCREEN=0
#MOJO_IMAGE_FILTERING_ENABLED=0

Here is the non working code:
#GLFW_WINDOW_FULLSCREEN=1
#MOJO_IMAGE_FILTERING_ENABLED=0

Any idea on what I'm doing wrong?


Fred(Posted 2014) [#2]
Salut David,

I don't know about this issue, but I did this Monkey tweak to handle bilinear for every image (I needed some with it and some without):
(lines number may have changed since I did it)

mojo/graphics.monkey
291: Function SetBilinear( flag:int )
CFG_MOJO_IMAGE_FILTERING_ENABLED_FLAG = flag
End

mojo/Graphicsdevice.monkey
12: Global CFG_MOJO_IMAGE_FILTERING_ENABLED_FLAG:Int

mojo/native/mojo.glfw.cpp
11: static int CFG_MOJO_IMAGE_FILTERING_ENABLED_FLAG = 0 ; // CFG_MOJO_IMAGE_FILTERING_ENABLED ;
664: // if( CFG_MOJO_IMAGE_FILTERING_ENABLED ){
if( CFG_MOJO_IMAGE_FILTERING_ENABLED_FLAG ){

call SetBilinear true or false before each glfw loadimage

You can also try: http://mungo.io/
It makes (among other things) MOJO_IMAGE_FILTERING_ENABLED working with html5 and chrome.


Fred(Posted 2014) [#3]
Recently, I used to start in windowed mode and allow to switch to full screen with this:
#if TARGET = "glfw"
	Function	CheckVideoMode:Void()
		local glg:GlfwGame = GlfwGame.GetGlfwGame()
		local glm:GlfwVideoMode[] = glg.GetGlfwVideoModes()    'GetGlfwDesktopMode()
		Print "Video modes: "
		for local vm:GlfwVideoMode = eachin glm
			Print "X: " + vm.Width + ", Y: " + vm.Height
		next
	End
	
	Function	GetHigherVideoMode:GlfwVideoMode()
	   	local glg:GlfwGame = GlfwGame.GetGlfwGame()
		local glm:GlfwVideoMode[] = glg.GetGlfwVideoModes()    'GetGlfwDesktopMode()
		local vm:GlfwVideoMode
		return glm[glm.Length()-1]
	End

	Function SetScreenMode:Void( mode:Int, resolx:Int, resoly:Int )
		FullScreenFlag = mode
		if mode			
			local vm:GlfwVideoMode = GetHigherVideoMode()
			GlfwGame.GetGlfwGame().SetGlfwWindow vm.Width,vm.Height,8,8,8,0,0,0,True
			ScreenWidth = vm.Width
			ScreenHeight = vm.Height
		else
			GlfwGame.GetGlfwGame().SetGlfwWindow resolx, resoly, 8,8,8,0,0,0,false
			ScreenWidth = resolx
			ScreenHeight = resoly
		endif
		ShowMouse()
	End
#end



David Casual Box(Posted 2014) [#4]
Salut Fred :)

You helped me with a key point! To avoid filtering in fullscreen, I have to use the native resolution of the computer, otherwise the graphic card seems to apply the filtering. I'm now manage to display what I want, thanks to the virtual resolution from diddy.

Your code is now part of Monkey, it is the SetDeviceWindow function.

Thanks again.