without anti-aliasing?

Monkey Forums/Monkey Programming/without anti-aliasing?

pyongpyong(Posted 2013) [#1]
hello~~~~~

I want the image output without anti-aliasing.

Monkey could not be found on the homepage.

Please give me some advice~~~


therevills(Posted 2013) [#2]
Use the pre-processor #MOJO_IMAGE_FILTERING_ENABLED="false" at the top of your code.


pyongpyong(Posted 2013) [#3]
therevills-
you AWESOOOOOOOOOOOOOOOME! Thank you!!!!!


pyongpyong(Posted 2013) [#4]
one more..
Android is filtering OK

No change in html5?


therevills(Posted 2013) [#5]
No change in html5?

If I recall correctly it depends on the browser...


FelipeA(Posted 2013) [#6]
What I've done to disable filtering on html5 is a bit hacky, but works for me.
Go to the native mojo file for html5 ( mojo.html5.js ), go to the line of code that looks like this:

gxtkGraphics.prototype.Cls=function( r,g,b ){
	if( this.tformed ) this.gc.setTransform( 1,0,0,1,0,0 );
	this.gc.fillStyle="rgb("+(r|0)+","+(g|0)+","+(b|0)+")";
        ...


and add:
	this.gc.imageSmoothingEnabled = false;	
	this.gc.mozImageSmoothingEnabled = false;
	this.gc.oImageSmoothingEnabled = false;
	this.gc.webkitImageSmoothingEnabled = false;


making it look like this:

gxtkGraphics.prototype.Cls=function( r,g,b ){

	this.gc.imageSmoothingEnabled = false;	
	this.gc.mozImageSmoothingEnabled = false;
	this.gc.oImageSmoothingEnabled = false;
	this.gc.webkitImageSmoothingEnabled = false;

	if( this.tformed ) this.gc.setTransform( 1,0,0,1,0,0 );
	this.gc.fillStyle="rgb("+(r|0)+","+(g|0)+","+(b|0)+")";
        ...


I know it's not the best way, but it works for me.
The other solution is using, devolonter's mojo GL, which you can find here:

http://monkeycoder.co.nz/Community/posts.php?topic=3276


zoqfotpik(Posted 2013) [#7]
Let me get this straight, this shows raw pixels or close?

Is there any way to force a lower resolution?


pyongpyong(Posted 2013) [#8]
ilovepixel-
In Chrome displayed. In Explorer not shown.
therevills's seems to fit the advice.

Thank you!:)


zoqfotpik(Posted 2013) [#9]
Therevills seems to know everything.


therevills(Posted 2013) [#10]
I'll be the first to say no I don't... just been around the block too long ;)


zoqfotpik(Posted 2013) [#11]
When I try #MOJO_IMAGE_FILTERING_ENABLED=false I get "Cannot convert from bool to string."


ElectricBoogaloo(Posted 2013) [#12]
I hate 1337est attitude, and I dislike it when people whinge at newbies for not picking up on the clues.
I despise horrible snarky forum replies, and hate the types of people who make them.

... but, as much as Monkey might occasionally throw up obscure cryptic conundrums as error messages, sometimes it gives you a perfectly valid one.
(.. and I'm in a particularly snarky mood, right now.)

When Monkey tells you that it "Cannot convert from bool to string.", what it's trying to tell you is that it cannot convert your requested parameter from a bool to a string.
This suggests that, somewhere in that one single line, with only one thing to look at, you're probably passing a Boolean, where you should be passing a String.
Take a good look at that long, and complex single line of code, and see if you can work out which bit it might like to be a string.

I suggest you start from the # on the left, and scroll your eyes gently towards the right hand side, where you may or may not notice a boolean within the code.
If you can spot the boolean, try changing it to a string.
Strings are usually enclosed within quote marks, or speech marks, or -->"<-- these things.
Give it a go, and see what you can come up with.


zoqfotpik(Posted 2013) [#13]
Careful.


ElectricBoogaloo(Posted 2013) [#14]
Sorry, not sure why, but I'm in a REALLY foul mood, this morning. Seem to be snipping and griping at everyone. Very unlike me.
.. well, not VERY unlike me.. But I usually throw my rants directly onto twitter so I don't come across as insensitive.

Today's your lucky day :D


zoqfotpik(Posted 2013) [#15]
Don't address me that way again. This is the only time I'm going to tell you.


Why0Why(Posted 2013) [#16]
false should be in quotes as in therevills example above = "false"


zoqfotpik(Posted 2013) [#17]
That's very peculiar-- I remember very clearly cutting it and pasting it which is why I didn't invest much brainpower in seeing what was wrong. Unless I'm losing my mind. Oh well, it works now!

Also it's worth mentioning that I'm getting a rather large speed increase with filtering turned off. Previously my apps would run slowly and jerkily for 30 seconds or so, after which they would run fairly smoothly. But this is far better.

I have to say that I've had the impression that Monkey performance under GLFW was much less than I would have liked, which was OK from my perspective because I write for tablets only. This does indeed drastically improve performance. My rig is from 2007 though, was top of the line at the time but has aged considerably.


Spinal(Posted 2013) [#18]
FRom what I remember, smoothing in HTML5 is pretty much forced on you and anything you do to correct it will only work in some browsers, not all of them.


therevills(Posted 2013) [#19]
Unless I'm losing my mind. Oh well, it works now!

No, your not - I noticed the error and corrected it after I posted. I actually copied it out of the Monkey docs, which should be fixed...


zoqfotpik(Posted 2013) [#20]
All right. I was actually going to pm you and ask if you had done that!


DruggedBunny(Posted 2013) [#21]
This seriously drives me nuts on the HTML5 target -- it's been a known bug in Windows versions of Chrome for well over a year now and they still haven't bothered fixing it, even with the huge popularity of 'retro' style pixel graphics these days:

https://code.google.com/p/chromium/issues/detail?id=134040

Apparently it's fine on Macs and some Linuxes, and possibly dev versions of Chromium on Windows, so the code is in there somewhere!

I've visited the example linked from the above bug report on every Chrome update for the last year to no avail:

http://jsfiddle.net/VAXrL/21/

(The large TV image should not be blurry.)

Even more hilarious, it actually *stopped* working with IE10 (as in, it worked in IEs 7-9) because they've suddenly decided to make -ms-interpolation-mode 'obsolete' but apparently haven't provided any other way to achieve the same effect!


The -ms-interpolation-mode property is obsolete as of Windows Internet Explorer 9. Do not use.



... um, OK... now what?!

Pixellated graphics in browsers appear to be of little to no interest to the browser developers.

This nasty, in-depth hack appears to be widely considered the most reliable way to do it, though it means rescaling the images via Javascript after loading (and I'm not sure it would affect 'manual' pixel drawing or if that would remain blurry). Of course, you'd also have to do it on every browser resize if the canvas was scaling to fit the browser window.

http://phoboslab.org/log/2012/09/drawing-pixels-is-hard

Unbelievable.