On Thu, Nov 20, 2008 at 4:16 PM, Steve <[EMAIL PROTECTED]> wrote: > > On Nov 20, 3:13 pm, "Casey Duncan" <[EMAIL PROTECTED]> wrote: > > Here's one way you could do it: > > > > Grab a texture from the buffer that is the bounding box of your lasso > selection. > > Make a lasso mask that is white only inside the selection > > draw the mask into the stencil buffer > > draw the rectangular texture you grabbed (with the stencil test on) > > into your destination buffer > > The stencil buffer is just what I needed. This example makes it very > easy to understand: > http://pseudogreen.org/bzr/pyglet_superbible/ch03/stencil.py >
For your lasso tool, you probably need to render an arbitrary mask texture into the stencil buffer, and I don't know offhand if this is possible. > On Nov 20, 3:16 pm, "Tristam MacDonald" <[EMAIL PROTECTED]> wrote: > > For a really simple approach, you can use multi-texturing with > > multiplicative blending against a mask texture. This will mask any areas > > where the mask texture is 0, and leave any areas where it is 1, but it > may > > not be the most flexible approach. > I couldn't find any useful information about this method with a > rudimentary web search. Off the top of my head, this is the necessary operation to enable multiplicative texture combination: glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, image_texture); glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, mask_texture); glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_ARB); glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_ARB, GL_BLEND); glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_ARB,GL_PREVIOUS); glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_ARB,GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
