[visionegg] Re: Mirroring a viewport?
- From: "Neil Halelamien" <neilh@xxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Thu, 6 Sep 2007 15:52:37 -0700
Thanks! I tried the latter suggestion, and that worked out well. In case
it's useful for anybody, I've attached my code to this email.
On 9/5/07, Andrew Straw <astraw@xxxxxxxxxxx> wrote:
>
> If you're just trying to do a 2D rotation of an image, the easiest thing
> to do is simply to draw the corners of the textured quad in their new
> positions. If you want to draw everything in the viewport flipped, you
> could do something like use the OrthographicProjection class with the
> top and bottom coordinates flipped.
>
> I hope that helped...
>
> Cheers!
> Andrew
>
> Neil Halelamien wrote:
> > This is kind of a basic question, but how do I rotate/flip a viewport's
> > perspective? My OpenGL knowledge is pretty limited so I might be doing
> > something silly, but my attempts so far at using
> > view.parameters.projection.rotate () and
> > view.parameters.projection.stateless_rotate() on a viewport with default
> > parameters have just resulted in making the viewport invisible.
> >
> > On 9/4/07, * Andrew Straw* <astraw@xxxxxxxxxxx
> > <mailto:astraw@xxxxxxxxxxx>> wrote:
> >
> > Hi Neil,
> >
> > See the multi_stim.py demo, in particular the put_new_framebuffer()
> > call.
> >
> > -Andrew
> >
> > Neil Halelamien wrote:
> > > Quick question: What's a straightforward way to mirror the
> > contents of a
> > > viewport onto another part of the screen?
> > >
> > > -- Neil
> >
> > ======================================
> > The Vision Egg mailing list
> > Archives: http://www.freelists.org/archives/visionegg
> > <http://www.freelists.org/archives/visionegg>
> > Website: http://www.visionegg.org/mailinglist.html
> >
> >
>
> ======================================
> The Vision Egg mailing list
> Archives: http://www.freelists.org/archives/visionegg
> Website: http://www.visionegg.org/mailinglist.html
>
>
# Includes utility function(s) for drawing mirrored/flipped viewports
try:
import logging
except ImportError:
import VisionEgg.py_logging as logging
import VisionEgg
import VisionEgg.Core
import VisionEgg.ParameterTypes as ve_types
def draw_mirrored_viewports(screen, view, flipaxes):
"""flipaxes is a list of (x,y) boolean pairs indicating axes to flip over,
e.g. flipaxes=[(False,True), (False, False)] would draw flipped over
y axis as well as without any flip at all.
Assumption is that original axes in view are 1:1 with pixel coordinates
"""
for a in flipaxes:
left = 0
right = screen.size[0]
bottom = 0
top = screen.size[1]
if a[0]:
left,right = right,left
if a[1]:
bottom,top = top,bottom
tmp_proj = VisionEgg.Core.OrthographicProjection(left=left, right=right,
bottom=bottom, top=top)
tmp_view = VisionEgg.Core.Viewport(screen=screen, projection=tmp_proj,
stimuli = view.parameters.stimuli)
tmp_view.draw()
- References:
- [visionegg] Mirroring a viewport?
- From: Neil Halelamien
- [visionegg] Re: Mirroring a viewport?
- From: Andrew Straw
- [visionegg] Re: Mirroring a viewport?
- From: Neil Halelamien
- [visionegg] Re: Mirroring a viewport?
- From: Andrew Straw
Other related posts:
- » [visionegg] Mirroring a viewport?
- » [visionegg] Re: Mirroring a viewport?
- » [visionegg] Re: Mirroring a viewport?
- » [visionegg] Re: Mirroring a viewport?
- » [visionegg] Re: Mirroring a viewport?
- [visionegg] Mirroring a viewport?
- From: Neil Halelamien
- [visionegg] Re: Mirroring a viewport?
- From: Andrew Straw
- [visionegg] Re: Mirroring a viewport?
- From: Neil Halelamien
- [visionegg] Re: Mirroring a viewport?
- From: Andrew Straw