[visionegg] Re: projections

Hi Mikko,

The issue is that you're not specifying the 3D coordinates of your
object where the camera can see them. The camera is located at the
origin and looking down the negative z axis. (This is opposite to most
3D systems as far as I can tell now, but this was by historical
accident.) So, you need to specify the vertices of your textured rectangle:

(PS, I'm working on that QuickTime bug, but it's proving harder to track
down than I hoped...)

#!/usr/bin/env python
"""Display a texture in 3D coordinates."""

import os
import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()

from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation, FunctionController
from VisionEgg.Textures import *

filename =
os.path.join(VisionEgg.config.VISIONEGG_SYSTEM_DIR,"data","panorama.jpg")
texture = Texture(filename)

screen = get_default_screen()

# Create the instance of TextureStimulus3D
duration = 5.0
speed = 1.0
z = duration*speed
stimulus = TextureStimulus3D(texture = texture,
                             shrink_texture_ok=True,
                             internal_format=gl.GL_RGBA,
                             )

def every_frame_func(t=None):
    z=t*speed-duration
    stimulus.parameters.upperleft=(-5,1,z)
    stimulus.parameters.lowerleft=(-5,-1,z)
    stimulus.parameters.lowerright=(5,-1,z)
    stimulus.parameters.upperright=(5,1,z)

every_frame_func(0.0) # set initial stimulus postion

projection = SimplePerspectiveProjection(fov_x=135.0)

viewport = Viewport(screen=screen,
                    projection=projection,
                    stimuli=[stimulus])

p = Presentation(go_duration=(duration,'seconds'),viewports=[viewport])
p.add_controller(None, None,
FunctionController(during_go_func=every_frame_func) )
p.go()

======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: