Presentation is loading. Please wait.

Presentation is loading. Please wait.

VR & TRANSF Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 23, 2004.

Similar presentations


Presentation on theme: "VR & TRANSF Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 23, 2004."— Presentation transcript:

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

2 23 Feb 2004CS 481/6812 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.

3 23 Feb 2004CS 481/6813 Review: Writing VR Juggler App’s [2/2] We write a VR Juggler Application. 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. preFrame intraFramedraw postFrame draw Start of Frame End of Frame

4 23 Feb 2004CS 481/6814 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.

5 23 Feb 2004CS 481/6815 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.

6 23 Feb 2004CS 481/6816 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.

7 23 Feb 2004CS 481/6817 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 *=.

8 23 Feb 2004CS 481/6818 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();

9 23 Feb 2004CS 481/6819 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();

10 23 Feb 2004CS 481/68110 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”?


Download ppt "VR & TRANSF Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 23, 2004."

Similar presentations


Ads by Google