without anti-aliasing?
Monkey Forums/Monkey Programming/without anti-aliasing?
| ||
hello~~~~~ I want the image output without anti-aliasing. Monkey could not be found on the homepage. Please give me some advice~~~ |
| ||
Use the pre-processor #MOJO_IMAGE_FILTERING_ENABLED="false" at the top of your code. |
| ||
therevills- you AWESOOOOOOOOOOOOOOOME! Thank you!!!!! |
| ||
one more.. Android is filtering OK No change in html5? |
| ||
No change in html5? If I recall correctly it depends on the browser... |
| ||
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 |
| ||
Let me get this straight, this shows raw pixels or close? Is there any way to force a lower resolution? |
| ||
ilovepixel- In Chrome displayed. In Explorer not shown. therevills's seems to fit the advice. Thank you!:) |
| ||
Therevills seems to know everything. |
| ||
I'll be the first to say no I don't... just been around the block too long ;) |
| ||
When I try #MOJO_IMAGE_FILTERING_ENABLED=false I get "Cannot convert from bool to string." |
| ||
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. |
| ||
Careful. |
| ||
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 |
| ||
Don't address me that way again. This is the only time I'm going to tell you. |
| ||
false should be in quotes as in therevills example above = "false" |
| ||
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. |
| ||
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. |
| ||
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... |
| ||
All right. I was actually going to pm you and ask if you had done that! |
| ||
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. |