Re: [racket-users] mode-lambda with antialiasing?

2016-11-14 Thread Jay McCarthy
On Mon, Nov 14, 2016 at 5:25 PM, David Vanderson
 wrote:
> Thanks Jay, I hope I'm not abusing the terminology.  If I have a sprite that
> is a line, and it's rotated a bit, then is that not similar to a polygon
> edge not falling on pixel boundaries?

Yes, that's what I meant by the rotated rectangles.

> As an example, I've attached a test program and a screenshot of the rotated
> and scaled down line segment.  This is the sort of thing I'm worried about.
> Any advice?

I could be wrong, but I don't think that there's an obvious
anti-aliasing algorithm that fits mode-lambda's use cases. I would
recommend rendering at a high buffer size and then down sampling. I
attached a version of your program that does this.

FWIW, since mode-lambda is imitating the SNES, it didn't really have
this problem because rotation only worked for the background layer in
Mode 7 and is almost exclusively used for chunky things rather than
fine things, so you wouldn't see bad aliasing of foreground elements.
However, looking at any Mode 7 effect, you instantly see the aliasing:

http://images.nintendolife.com/screenshots/16705/large.jpg

http://img.gamefaqs.net/screens/8/9/8/gfs_40216_2_4.jpg

http://media.tiltingatpixels.com/tilting/final_fantasy_4_flying.png

> I didn't know that mode-lambda made sure that each pixel only came from a
> single sprite.  Even if some sprites have some transparency?

Within a layer, there is no transparency. Transparency is only across
layers. Section 1 of the docs says, "mode-lambda makes no guarantees
about the layering and transparency behavior of sprites within a
single layer."


-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ml-line.rkt
Description: Binary data


Re: [racket-users] mode-lambda with antialiasing?

2016-11-14 Thread David Vanderson
Thanks Jay, I hope I'm not abusing the terminology.  If I have a sprite
that is a line, and it's rotated a bit, then is that not similar to a
polygon edge not falling on pixel boundaries?

As an example, I've attached a test program and a screenshot of the rotated
and scaled down line segment.  This is the sort of thing I'm worried
about.  Any advice?

I didn't know that mode-lambda made sure that each pixel only came from a
single sprite.  Even if some sprites have some transparency?

Thanks,
Dave

On Mon, Nov 14, 2016 at 2:20 PM, Jay McCarthy 
wrote:

> Hi David,
>
> I know what anti-aliasing is, but I don't think I know how you mean it
> to apply for mode-lambda.
>
> mode-lambda renders a W1xH1 scene onto a W2xH2 canvas and by default
> uses a scaling algorithm that is "pixel-perfect" and could be made to
> be more fuzzy. Right now, it offers two scalers and could offer more.
>
> Within a particular rendering, mode-lambda can return a WxH sprite
> with some scaling applied (the #:mx and #:my parameters) and it again
> does it in a "pixel-perfect" way. This is a pretty deep assumption,
> but in principle could be changed.
>
> In normal 3D graphics engines, anti-aliasing is used because polygon
> edges (lines) do not even fall on pixel boundaries, so there are
> subtle techniques to figure how they line up well. Given that
> mode-lambda only renders rectangles and guarantees that within a layer
> every pixel comes from exactly one sprite, I think the normal things
> would apply less well. I think this is assumption of mode-lambda that
> you want changed so that a rotated sprite would combine its pixel
> value with the other sprite sharing a portion of the same location
> given that the ultimate rendering canvas would accommodate them?
>
> Jay
>
>
>
>
>
>
> On Mon, Nov 14, 2016 at 1:57 PM, David Vanderson
>  wrote:
> > I'm working on converting my game to use mode-lambda, and it's going
> pretty
> > well so far, but I'd like to get smoother rendering of sprites rotated &
> > scaled.
> >
> > I was hoping that (send gl-config set-multisample-size 4) would take
> care of
> > it.  That works for some raw opengl stuff I've tried, but not for
> > mode-lambda.
> >
> > Is there some switch I've missed?  Or does this need deeper changes to
> the
> > shaders?  I'm happy to dig into it but wanted to make sure I wasn't
> missing
> > something obvious.
> >
> > Thanks,
> > Dave
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Jay McCarthy
> Associate Professor
> PLT @ CS @ UMass Lowell
> http://jeapostrophe.github.io
>
>"Wherefore, be not weary in well-doing,
>   for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>   - D 64:33
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ml-line.rkt
Description: Binary data


Re: [racket-users] mode-lambda with antialiasing?

2016-11-14 Thread Jay McCarthy
Hi David,

I know what anti-aliasing is, but I don't think I know how you mean it
to apply for mode-lambda.

mode-lambda renders a W1xH1 scene onto a W2xH2 canvas and by default
uses a scaling algorithm that is "pixel-perfect" and could be made to
be more fuzzy. Right now, it offers two scalers and could offer more.

Within a particular rendering, mode-lambda can return a WxH sprite
with some scaling applied (the #:mx and #:my parameters) and it again
does it in a "pixel-perfect" way. This is a pretty deep assumption,
but in principle could be changed.

In normal 3D graphics engines, anti-aliasing is used because polygon
edges (lines) do not even fall on pixel boundaries, so there are
subtle techniques to figure how they line up well. Given that
mode-lambda only renders rectangles and guarantees that within a layer
every pixel comes from exactly one sprite, I think the normal things
would apply less well. I think this is assumption of mode-lambda that
you want changed so that a rotated sprite would combine its pixel
value with the other sprite sharing a portion of the same location
given that the ultimate rendering canvas would accommodate them?

Jay






On Mon, Nov 14, 2016 at 1:57 PM, David Vanderson
 wrote:
> I'm working on converting my game to use mode-lambda, and it's going pretty
> well so far, but I'd like to get smoother rendering of sprites rotated &
> scaled.
>
> I was hoping that (send gl-config set-multisample-size 4) would take care of
> it.  That works for some raw opengl stuff I've tried, but not for
> mode-lambda.
>
> Is there some switch I've missed?  Or does this need deeper changes to the
> shaders?  I'm happy to dig into it but wanted to make sure I wasn't missing
> something obvious.
>
> Thanks,
> Dave
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] mode-lambda with antialiasing?

2016-11-14 Thread David Vanderson
I'm working on converting my game to use mode-lambda, and it's going pretty
well so far, but I'd like to get smoother rendering of sprites rotated &
scaled.

I was hoping that (send gl-config set-multisample-size 4) would take care
of it.  That works for some raw opengl stuff I've tried, but not for
mode-lambda.

Is there some switch I've missed?  Or does this need deeper changes to the
shaders?  I'm happy to dig into it but wanted to make sure I wasn't missing
something obvious.

Thanks,
Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] raco run but (please) dont process the docs

2016-11-14 Thread Philip McGrath
On the subject of package documentation, 
http://docs.racket-lang.org/pkg/catalog-protocol.html appears to be incorrect 
when it says that:
The source for the PLT-hosted package catalog is in the 
(collection-file-path "pkg-catalog" "meta") directory of the 
full Racket distribution.

My installation tells me that collection is not found.

It looks like the source is actually provided by the package "pkg-index".

Philip


On Sunday, October 23, 2016 at 11:43:58 AM UTC-5, Matthew Flatt wrote:
> I'll bring that FAQ up-to-date to explain that built packages are now
> provided by the catalog
> 
>  https://pkg-build.racket-lang.org/server/built/catalog/
> 
> See also
> 
>  https://pkg-build.racket-lang.org/about.html
> 
> 
> At Sun, 23 Oct 2016 12:16:02 +0200, Daniel Brunner wrote:
> > Hi Meino,
> > 
> > have a look at this FAQ:
> > 
> > http://docs.racket-lang.org/pkg/FAQ.html#%28part._.How_can_.I_install_a_package
> > _without_its_documentation_%29
> > 
> > For some packages there exist two "sub" packages: One with "...-lib"
> > which does not contain any documentation and does not depend on scribble
> > etc. and a package which includes only the docoumentation "...-doc".
> > 
> > This does not work for all packages. Those who do not seperate the code
> > from the documentation you could stick with "binary" or "built"
> > packages: http://docs.racket-lang.org/pkg/strip.html
> > 
> > At the moment you have to build these packages yourself and put them on
> > your device for installation. As far as I know there are future plans to
> > provide these packages online.
> > 
> > 
> > Best wishes,
> > Daniel
> > 
> > 
> > Am 23.10.2016 um 11:09 schrieb meino.cra...@gmx.de:
> > > Hi,
> > > 
> > > I have installed racket on my Android tablet.
> > > For this I have the device rooted
> > > and installed a chrooted Archlinux,
> > > which in turn provides the prebuild
> > > racket-package 6.6.
> > > By the way: The tablet has a x86 iIntel CPU
> > > but nothing "big iron"-like. About 400MB
> > > free RAM is available.
> > > 
> > > BUT:
> > > When I install an additional package like csv-reading
> > > via raco pkg install it also processes the scribble
> > > docs to pdf via TeX of that package.
> > > And that's much too much for my little tablet.
> > > It instantly kills the terminal app and resets.
> > > 
> > > It there any way to tell raco what kind
> > > of doc processing is wanted and what don't?
> > > 
> > > Cheers,
> > > Meino
> > > 
> > > 
> > > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] filesystem-change-evt and thread-suspend

2016-11-14 Thread Philip McGrath
Thanks very much for the quick workaround (and ultimately for the repair) — 
it's always a relief to know I haven't overlooked some detail!

On Monday, November 14, 2016 at 9:30:17 AM UTC-6, Matthew Flatt wrote:
> No, that's not supposed to happen. I've pushed a repair.
> 
> 
> I was able to replicate the problem on Mac OS X, and it looks like the
> problem with filesystem events is specific to that platform. But the
> filesystem-event problem is due to a more general bug in the scheduler,
> and the same bug shows up with
> 
>(sync (wrap-evt s (lambda (v) 'ok)))
> 
> on all platforms.
> 
> The problem is related to `thread-suspend`, a semaphore becoming ready
> while the thread is suspended, and having a wrapper (in the sense of
> `wrap-evt`) around the semaphore. That pattern happens internally with
> filesystem events on Mac OS X. I think `thread-suspend` probably isn't
> used that much, which would explain how this scheduler bug survived for
> so long.
> 
> 
> You can work around the bug by creating a dummy pipe and waiting for
> the input end of the pipe in addition to the filesystem event, like
> this:
> 
>(define-values (dummy-i dummy-o) (make-pipe))
>(sync dummy-i (wrap-evt s (lambda (v) 'ok)))
> 
> Having a pipe in the set of events sends the scheduler into a path that
> doesn't have the bug.
> 
> 
> At Sun, 13 Nov 2016 17:43:43 -0800 (PST), Philip McGrath wrote:
> > Hi everyone,
> > 
> > I've been trying to get to know Racket's threads and particularly 
> > filesystem-change-evt, and I've come to a point of confusion. I thought 
> > that a 
> > filesystem-change-evt's synchronization result was supposed to be the event 
> > itself, which it is most of the time, but in combination with 
> > thread-suspend 
> > it seems to produce #f, and I'm not sure why.
> > 
> > Here's a tiny example:
> > 
> > > (define t
> >(thread (λ ()
> >(println (sync (filesystem-change-evt "test"))
> > > (thread-suspend t)
> > ;; at this point I go and do something like "echo foo >test"
> > > (thread-resume t)
> > ;; prints #f
> > 
> > Is this supposed to happen?
> > 
> > What's particularly confusing is that the same thing happens (i.e. #f is 
> > printed) if I instead define t to be:
> > 
> > (thread
> >(λ ()
> >  (println
> >(sync (wrap-evt (filesystem-change-evt "test")
> >(λ (x) 'my-result))
> > 
> > Does anyone know what's going on?
> > 
> > Thanks,
> > Philip
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Logging and stdout in web-server

2016-11-14 Thread Luke
That worked just fine, thanks Jay!


Luke

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] filesystem-change-evt and thread-suspend

2016-11-14 Thread Matthew Flatt
No, that's not supposed to happen. I've pushed a repair.


I was able to replicate the problem on Mac OS X, and it looks like the
problem with filesystem events is specific to that platform. But the
filesystem-event problem is due to a more general bug in the scheduler,
and the same bug shows up with

   (sync (wrap-evt s (lambda (v) 'ok)))

on all platforms.

The problem is related to `thread-suspend`, a semaphore becoming ready
while the thread is suspended, and having a wrapper (in the sense of
`wrap-evt`) around the semaphore. That pattern happens internally with
filesystem events on Mac OS X. I think `thread-suspend` probably isn't
used that much, which would explain how this scheduler bug survived for
so long.


You can work around the bug by creating a dummy pipe and waiting for
the input end of the pipe in addition to the filesystem event, like
this:

   (define-values (dummy-i dummy-o) (make-pipe))
   (sync dummy-i (wrap-evt s (lambda (v) 'ok)))

Having a pipe in the set of events sends the scheduler into a path that
doesn't have the bug.


At Sun, 13 Nov 2016 17:43:43 -0800 (PST), Philip McGrath wrote:
> Hi everyone,
> 
> I've been trying to get to know Racket's threads and particularly 
> filesystem-change-evt, and I've come to a point of confusion. I thought that 
> a 
> filesystem-change-evt's synchronization result was supposed to be the event 
> itself, which it is most of the time, but in combination with thread-suspend 
> it seems to produce #f, and I'm not sure why.
> 
> Here's a tiny example:
> 
> > (define t
>(thread (λ ()
>(println (sync (filesystem-change-evt "test"))
> > (thread-suspend t)
> ;; at this point I go and do something like "echo foo >test"
> > (thread-resume t)
> ;; prints #f
> 
> Is this supposed to happen?
> 
> What's particularly confusing is that the same thing happens (i.e. #f is 
> printed) if I instead define t to be:
> 
> (thread
>(λ ()
>  (println
>(sync (wrap-evt (filesystem-change-evt "test")
>(λ (x) 'my-result))
> 
> Does anyone know what's going on?
> 
> Thanks,
> Philip
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Logging and stdout in web-server

2016-11-14 Thread Jay McCarthy
Hi Luke,

You are right to use serve/servlet and friends rather than the
configuration-table stuff, which is just there for backwards
compatibility.

If you really want to use dispatch-log, then you'll need to use
serve/launch/wait and dispatch/servlet:
http://docs.racket-lang.org/web-server-internal/web-server.html#%28def._%28%28lib._web-server%2Fservlet-dispatch..rkt%29._dispatch%2Fservlet%29%29

However, I recommend not doing that and just stick in a call to print
before dispatch like

(define (real-dispatch req)
 (print-log req)
 (old-dispatch req))

The code that dispatch-log gives you is so trivial, you should tailor
it to what information you want:

https://github.com/racket/web-server/blob/master/web-server-lib/web-server/dispatchers/dispatch-log.rkt#L43

On Sun, Nov 13, 2016 at 2:36 PM, Luke  wrote:
> Does anyone have any tips on how to turn on transparent request logging from 
> this question above?
>
> 2) How do I insert the transparent request logger in my dispatch-rules so 
> that request info will be shown on stdout?
>
> Thanks!
>
> Luke
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Request for comments: An embedded DSL for CSS in Racket

2016-11-14 Thread Leandro Facchinetti
Hi WarGrey Gyoudmon Ju,

I’m happy to know that other people are working on the same space. It
seems like we’re taking different approaches and I’d like to see your
project when you release it.

Best.
-- 
Leandro Facchinetti 
https://www.leafac.com
GPG: 0x5925D0683DF3D583

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.