1 / 10

VR & TRANSF

VR & TRANSF. Glenn G. Chappell CHAPPELLG@member.ams.org U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 23, 2004. Review: Writing VR Juggler App’s [1/2]. For our VR programming, we are using a library called VR Juggler . Free & open-source.

lenka
Download Presentation

VR & TRANSF

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VR & TRANSF Glenn G. ChappellCHAPPELLG@member.ams.org U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 23, 2004

  2. Review:Writing VR Juggler App’s [1/2] • For our VR programming, we are using a library called VR Juggler. • Free & open-source. • Developed at VRAC, Iowa State U. • C++ • Not hardware- or OS-specific. • Run it on your own computer. • The functionality provided by VRJ is roughly the same as that of all major VR library: • Manages windows, contexts, threads, hardware configuration (including stereo/mono). • Interface to VR input devices. • Sets up projection matrices based on user’s position. • Calls user code for display, etc. CS 481/681

  3. Review:Writing VR Juggler App’s [2/2] • We write a VR JugglerApplication. • This is a C++ object. • Callbacks are public member functions. • Execution is multithreaded, synchronized according to “frames”. • All threads have the same static & dynamic memory spaces. • Watch out for conflicts! • See simpleApp for an example. Start of Frame preFrame intraFrame draw draw postFrame End of Frame CS 481/681

  4. Review:Discovery Lab Training • All CS 481/681 students get “Discovery Lab Operator” status. • Access to lab. • Accounts on ARSC SGI’s, including igie. • Can bring guests. • Drinks not allowed near console & screens. • When you use the lab, you are responsible for keeping it clean and not misusing the equipment. • When you leave the DLab: • Log out. • If no one else is there: • Plug the driver glasses & wand into their chargers. • Mute the audio. • Turn off the projectors. • Log out of the touch panel. • Dim the lights. • Make sure the doors are fully closed. CS 481/681

  5. VR & TRANSF:Flying [1/3] • Write a (desktop) flyer that uses a variable of type transf to hold the viewing transformation. • Use tfogl.h where is it convenient. • See tffly.cpp, on the web page. • The following slides contain some of the relevant ideas. CS 481/681

  6. VR & TRANSF:Flying [2/3] • Storing the Viewing Transformation • Define a global of type transf; this does everything a plane/spaceship can do. transf viewtf; • Using the Viewing Transformation • In the display function: glPushMatrix(); glTransform(viewtf); // Uses tfogl.h … // Draw transformed objects glPopMatrix(); • Initializing the Viewing Transformation viewtf = transf(vec(0., 0., -3.)); // In function init? • Type vec represents a translation. Convert to transf so the assignment works. CS 481/681

  7. VR & TRANSF:Flying [3/3] • Changing the Viewing Transformation • Save the mouse position & button states where appropriate. • Use these to modify viewtf in the idle function. • Generally: transf newtf = …; viewtf = compose(newtf, viewtf); glutPostRedisplay(); • Equivalent forms of the middle line: viewtf = newtf.compose(viewtf); viewtf = viewtf.lcompose(newtf); // lcompose: l = left viewtf.lcompose_assign(newtf); • The last two are like * and *=. CS 481/681

  8. VR & TRANSF:Moving with the Wand • In terms of transformations, one of the trickier parts of VR is moving objects together in an arbitrary frame of reference. • For example, moving an object with the wand. • To draw an object in the wand’s frame of reference: glPushMatrix(); glTransform(myUser.getTransf(USR_WAND)); … // Draw transformed objects glPopMatrix(); CS 481/681

  9. VR & TRANSF:Where is the Wand Pointing? • To find where the wand points: vec wandDir = myUser.getFrontVec(USR_WAND); • How do we turn this into a 2-D vector (no up/down)? • Solution 1: wandDir[1] = 0.; wandDir = wandDir.normalized(); • Solution 2: wandDir -= wandDir.component(vec(0.,1.,0.)); wandDir = wandDir.normalized(); CS 481/681

  10. VR & TRANSF:Harder Problems • How do we grab a stationary object with the wand? • Always grab the “right” object. • No “popping” into place? • How do we create a usable “flying” interface for the CAVE? • What about “walking”? CS 481/681

More Related