It now looks like I have a new challenge.  The masking is working well for one rectangle, but what I need is when there's two rectangles on the screen, that the border of one rectangle is visible in the middle of the other, and vise versa.  Right now, the middle of one rectangle blocks out border of another.  It looks like I might have to build each rectangle using 4 put together, but I wanted to avoid this for asthetics' sake.

Again thanks for all your help.  So there doesn't seem to be a [disk] object but with adjustable sides?  Maybe I should start learning how to write an external.

Cheers! 

On Sat, Jun 12, 2010 at 5:06 PM, Ryan Trigg <ryan.trigg@gmail.com> wrote:
Thank you to all for being so helpful!  Cyrille, that looks exactly what I'm looking for.  I can stop pulling the hair out of my head.

Thanks again everyone.

Cheers!

Ryan


On Sat, Jun 12, 2010 at 2:23 AM, cyrille henry <ch@chnry.net> wrote:


Le 12/06/2010 11:17, Jack a écrit :

Yes it is working fine ;)
I thought about a solution without the translation.
without the translation, it could work, but i'm not sure the result will be the same on every GPU.


c

This is a nice example for the importance of the rendering order.
++

Jack



Le samedi 12 juin 2010 à 09:25 +0200, cyrille henry a écrit :
hello,

i may have misunderstood the question, because i think there is a much simple solution using rendering order.
see attachment.
c


Le 12/06/2010 07:05, patko a écrit :
hi again,

  after reflexion, I don't think it's a good idea to snap and apply alpha
when you want to apply a texture on the outer rectangle, some pixels might
disappear when they have the same amount of color that is supposed to disappear on the masking process.

It might be possible to apply a texture mapping on vertices drawn with openGL functions rather,
but I've no clue about how it could be done yet.

  Or just use the method proposed by jack that is about using four rectangles if you don't use a texture, you can connect them together like this:

[gemhead]
|
[translateXYZ -1 0 0]
|
[rectangle 0.2 1]
|
[translateXYZ 0.8 1 0]
|
[rectangle 1 0.2]
|
etc...



  Just loading an image containing the alpha hole, like attached would be cpu wise, very simple to do with an image editor,
and wouldn't add artefacts on your texture.
  I've attached an example patch and the gimp image, on gimp just draw the two rectangles, select the inner rectangle, go to Colors menu,
and then choose "Color to alpha".
  I've choosen the tiff format because it works on most platforms, unlike png.

Patrice Colet - 06 32 66 03 57

----- "Jack"<jack@rybn.org>   a écrit :

Hello,

You have several possibilities to do what you are looking for :
- use (as Patrick describe) two rectangles to create a mask (with
[gemframebuffer], [pix_snap] and [pix_buffer], [pix_buffer_read],
[pix_buffer_write]) then [pix_mask] or [pix_multiply];
- use four [rectangle]s to build 'lines' of the rectangle;
- use GLSL to create the mask and the final image.
Surely, there are other ways (like openGL objects with GEM for
example)...
See in help>   browser>   examples>   GEM (in Pd-extended) to understand
what this objects do.
Hope that helps somewhat.
++

Jack




Le vendredi 11 juin 2010 à 10:03 -0700, Ryan Trigg a écrit :
Patrice,


Thanks for your reply, sounds like interesting options (especially
the
snapping two rectangles together)...could you be more specific with
instructions on what objects to use?  Pardon my novice GEM skills.


Merci!


Ryan

On Fri, Jun 11, 2010 at 9:49 AM, patko<colet.patrice@free.fr>
wrote:
         hello,
          you can put an image texture with a rectangle made of
alpha
         pixels,
          or draw an alpha rectangle using  gridflow and then load
it
         as a texture
         with #to_pix,
          or snap two rectangles with different colors,
          and turn to alpha all pixels matching the inner rectangle.

         Patrice Colet - 06 32 66 03 57

         ----- "Ryan Trigg"<ryan.trigg@gmail.com>   a écrit :


         >   I am trying to mask [rectangle] using GEM with another
         smaller
         >   [rectangle] (that controls the first rectangle's alpha
value
         wherever
         >   it is placed) in order to create an adjustable rectangle
         outline (that
         >   has a border of my desired thickness). I noticed that you
         can choose
         >   [draw line( and [width $1( for a rectangle but the
maximum
         thickness
         >   of the line is much too small. Does anyone have any
thoughts
         or ideas?
         >
         >
         >   Or maybe there's an object like [disk] (using 4 segments)
         but with the
         >   ability to adjust the height and width just like
[rectangle]
         >
         >
         >
         >   Cheers!
         >
         >
         >   Ryan

         >   _______________________________________________
         >   Pd-list@iem.at mailing list
         >   UNSUBSCRIBE and account-management ->
         >   http://lists.puredata.info/listinfo/pd-list


_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list


_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management ->   http://lists.puredata.info/listinfo/pd-list