:-)
On Nov 24, 9:11 pm, "Casey Duncan" <[EMAIL PROTECTED]> wrote:
> No, I need to get off my duff and post some 8^)
>
> -Casey
>
> On Sat, Nov 22, 2008 at 8:45 AM, Jonathan Hartley <[EMAIL PROTECTED]> wrote:
>
> > Hey Casey. Py-lepton looks cool. Are there any screenshots of it in
> > action? I couldn't spot any on the project page.
>
> > On Nov 20, 9:35 pm, "Casey Duncan" <[EMAIL PROTECTED]> wrote:
> >> Here's a recent project I've been working on in python/C for games:
>
> >>http://code.google.com/p/py-lepton/source/browse/trunk/
>
> >> Note there is nothing os x specific about it other than the location
> >> of some include and library directories in setup.py because it depends
> >> on the OpenGL C API. Everything else is vanilla distutils.
>
> >> -Casey
>
> >> On Thu, Nov 20, 2008 at 2: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
>
> >> > My test code ended up looking like this (graphics lib more or less
> >> > wraps some basic pyglet/OpenGL calls):
> >> > pyglet.gl.glClearStencil(0)
> >> > pyglet.gl.glEnable(pyglet.gl.GL_STENCIL_TEST)
> >> > pyglet.gl.glClear(pyglet.gl.GL_STENCIL_BUFFER_BIT)
> >> > pyglet.gl.glStencilFunc(pyglet.gl.GL_NEVER, 0x0, 0x0)
> >> > pyglet.gl.glStencilOp(pyglet.gl.GL_INCR, pyglet.gl.GL_INCR,
> >> > pyglet.gl.GL_INCR)
>
> >> > graphics.set_color(1,1,1,1)
> >> > graphics.draw_rect(self.x1,self.y1,self.x2,self.y2)
> >> > graphics.set_color(0,0,0,1)
> >> > graphics.draw_ellipse(self.x1,self.y1,self.x2,self.y2)
> >> > pyglet.gl.glStencilFunc(pyglet.gl.GL_NOTEQUAL, 0x1, 0x1)
> >> > pyglet.gl.glStencilOp(pyglet.gl.GL_KEEP, pyglet.gl.GL_KEEP,
> >> > pyglet.gl.GL_KEEP)
> >> > graphics.set_color(1,1,1,1)
> >> > graphics.draw_image(self.selection, self.x1, self.y1)
> >> > pyglet.gl.glDisable(pyglet.gl.GL_STENCIL_TEST)
> >> > That code draws an oval-shaped section of the image self.selection.
>
> >> > 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.
>
> >> >> If you are using shaders, you can use a mask texture and a pixel shader
> >> >> to
> >> >> render only the unmasked portion of another texture (use the discard
> >> >> instruction for masked pixels).
>
> >> >> If you aren't using shaders, you may be able to work something out with
> >> >> the
> >> >> stencil buffer, although this wont be as straightforward.
> >> > My OpenGL knowledge is scattered and specialized, so I'm not using
> >> > shaders. The stencil buffer method was actually very straightforward:
> >> > use boilerplate setup code, draw mask, then more boilerplate, then
> >> > draw stuff, then more boilerplate.
>
> >> >> C extensions are pretty much identical on OS X to linux, although you do
> >> >> need to pass the compiler a few different options. If you need help
> >> >> constructing a makefile for a C extension, I have several extension
> >> >> modules
> >> >> building cross-platform, so I can probably explain the process.
> >> > I tried looking for examples a few days ago but couldn't find anything
> >> > more recent than OS X 10.2, which had a much earlier version of
> >> > Python. Links to examples would be much appreciated. I'm decent with
> >> > C, but have used it primarily for homework assignments, so for now I'm
> >> > considering a C extension to be out of the scope of this project.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---