develop-25 9603 March 1996
From the originals
13 scansMachine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.
These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.
Image 1
GX Breaks the Space Hack • Display Manager • Using ToolServer From CodeWarrior develop The Apple Technical Journal Issue 25 March 1996 Generating QuickTime VR Movies From QuickDraw 3D Flicker-Free Drawing With QuickDraw GX NURB Curves: A Guide for the Uninitiated Using C++ Exceptions in C Country Stringing: Localized Strings for the Newton $10.00
A cover illustration shows a rendered room with a brown frame, a cylindrical gallery wall holding framed abstract pictures and arched openings, and a small figure in a purple shirt standing at the center, with an Apple logo at upper right.
Reading notes: Article titles and the masthead are clearly legible; small framed artwork in the illustration contains no readable text. Reading order follows the top banner, masthead, issue line, left-column headlines, then the price at bottom left.
- Printed product names
- develop The Apple Technical Journal
- Printed prices
- $10.00
- Printed dates
- March 1996 · Issue 25
- Languages
- English
PDF page 1
Generating QuickTime VR Movies From QuickDraw 3D Flicker-Free Drawing With QuickDraw GX NURB Curves: A Guide for the Uninitiated Using C++ Exceptions in C Country Stringing: Localized Strings for the Newton Issue 25 March 1996 d e v e l o p T h e A p p l e T e c h n i c a l J o u r n a l $10.00 GX Breaks the Space Hack • Display Manager • Using ToolServer From CodeWarrior
Reading notes: Headline is null because the cover carries several equal-weight cover lines and none is clearly primary. The masthead is set with spaced-out letters, rendered in the supplied copy as 'd e v e l o p T h e A p p l e T e c h n i c a l J o u r n a l'; its exact layout could not be confirmed from the copy alone. The product names listed are technologies named in article titles and cover lines rather than paid advertisements. Transcript is intentionally empty because the exact extracted text is preserved separately.
- Printed product names
- QuickTime VR · QuickDraw 3D · QuickDraw GX · Newton · C++ · C · CodeWarrior · ToolServer
- Printed prices
- $10.00
- Printed dates
- March 1996
- Languages
- English
PDF page 2
E D I T O R I A L S T A F F Editor-in-Cheek Caroline Rose Managing Editor Toni Moccia Technical Buckstopper Dave Johnson Bookmark CD Leader Alex Dosher Able Assistant Meredith Best Our Boss Mark Bloomquist His Boss Dennis Matthews Review Board Brian Bechtel, Dave Radcliffe, Jim Reekes, Bryan K. “Beaker” Ressler, Larry Rosenstein, Andy Shebanow, Nick Thompson, Gregg Williams Contributing Editors Lorraine Anderson, Steve Chernicoff, Linda Fogel, Toni Haskell, Judy Helfand, Cheryl Potter, Joan Stigliani Indexer Marc Savage A R T & P R O D U C T I O N Art Direction Lisa Ferdinandsen Technical Illustration John Ryan, Laurie Wigham Formatting Forbes Mill Press Production Diane Wilcox Photography Sharon Beals, Naomi Chesler Cover Illustration Graham Metcalfe of Metcalfe/Shuhert Design ISSN #1047-0735. © 1996 Apple Computer, Inc. All rights reserved. Apple, the Apple logo, APDA, AppleLink, AppleScript, ColorSync, HyperCard, LaserWriter, Mac, MacApp, MacBrowser, Macintosh, MacTCP, MPW, MultiFinder, Newton, NewtonMail, OpenDoc, PhotoFlash, PlainTalk, PowerBook, Power Mac, Power Macintosh, QuickTime, TrueType, and WorldScript are trademarks of Apple Computer, Inc., registered in the U.S. and other countries. AOCE, A/ROSE, develop, Dylan, eWorld, Finder, NewtonScript, PowerTalk, QuickDraw, and ToolServer are trademarks of Apple Computer, Inc. Adobe, Acrobat, and PostScript are trademarks of Adobe Systems Incorporated or its subsidiaries and may be registered in certain jurisdictions. PowerPC is a trademark of International Business Machines Corporation, used under license therefrom. UNIX is a registered trademark of Novell, Inc. in the United States and other countries, licensed exclusively through X/Open Company, Ltd. NuBus is a trademark of Texas Instruments. All other trademarks are the property of their respective owners. T H I N G S T O K N O W develop, The Apple Technical Journal, a quarterly publication of Apple Computer’s Developer Press group, is published in March, June, September, and December. develop articles and code have been reviewed for robustness by Apple engineers. This issue’s CD. Subscription issues of develop are accompanied by the develop Bookmark CD. This CD contains a subset of the materials on the monthly Developer CD Series , available through the Apple Developer Catalog. Included on the CD are this issue and all back issues of develop along with the code that the articles describe. (The code is updated periodically, so always use the most recent CD.) The CD also contains Technical Notes, sample code, and other documentation and tools (these contents are subject to change). Items referred to as being on “this issue’s CD” are located on either the Bookmark CD or the Reference Library or Tool Chest edition of the Developer CD Series . Much of the CD contents, including the develop issues and code, are also available in the Developer Services area on AppleLink and at ftp.info.apple.com. See also the World Wide Web site for Apple Developer Services and Products, at http://dev.info.apple.com. Macintosh Technical Notes. A designation like “(QT 4)” after a reference to a Macintosh Technical Note or Macintosh Technical Q&A in develop indicates the category and number of the Note on this issue’s CD. (QT is the QuickTime category.) The new (uncategorized) Technotes are designated by number alone. E-mail addresses. Many e-mail addresses that are mentioned in develop are AppleLink addresses. On the Internet, AppleLink address XXX translates to xxx@applelink.apple.com. NewtonMail address XXX translates to xxx@online.apple.com. C O N T A C T I N G U S Feedback. Send editorial comments or suggestions to Caroline Rose at AppleLink CROSE, Internet crose@applelink.apple.com, or fax (408)974-6395. Send technical questions about develop to Dave Johnson at AppleLink JOHNSON.DK, Internet dkj@apple.com, CompuServe 75300,715, or fax (408)974-6395. Or write to Caroline or Dave at Apple Computer, Inc., 1 Infinite Loop, Cupertino, CA 95014. Article submissions. Ask for our Author’s Guidelines and a submission form at AppleLink DEVELOP, Internet develop@applelink.apple.com, or fax (408)974-6395. Or write to Caroline Rose at the above address. Subscriptions and back issues. You can subscribe to develop through the Apple Developer Catalog (see ordering information below) or use the subscription card in this issue. You can also order printed back issues through the catalog. The one-year U.S. subscription price is $30 (for 4 issues and 4 develop Bookmark CDs), or U.S. $50 in other countries. Back issues are $13 each. These prices include shipping and handling. For Canadian orders, the subscription price includes GST (R100236199). Apple Developer Catalog. To order develop or other products through the catalog, or to make subscription- related queries, call 1-800-282-2732 in the U.S., 1-800-637-0029 in Canada, (716)871-6555 internationally, or (716)871-6511 for fax. You can send e-mail to AppleLink APDA, Internet apda@applelink.apple.com, America Online APDAorder, or CompuServe 76666,2405. Or write Apple Developer Catalog, Apple Computer, Inc., P.O. Box 319, Buffalo, NY 14207-0319. For all subscription changes or queries, please be sure to include your name, address, and account number as it appears on your mailing label. Printed on recycled paper d e v e l o p
Reading notes: No image was attached, so the fields were filled from the supplied copy only and the layout and visual description are inferred rather than observed. Section headings such as EDITORIAL STAFF, ART & PRODUCTION, THINGS TO KNOW, and CONTACTING US are printed with letter spacing and are not treated as a primary headline, so headline is null. Playful job titles such as Editor-in-Cheek, Technical Buckstopper, Bookmark CD Leader, Able Assistant, Our Boss, and His Boss are printed as shown and are not names of products. The ISSN, copyright year range, phone numbers, fax numbers, postal box, and reference codes such as (QT 4) and R100236199 were not treated as prices or dates. Publication schedule months (March, June, September, December) are not listed as printed dates because they describe frequency rather than a specific date.
- Printed product names
- develop · develop Bookmark CD · Developer CD Series
- Printed prices
- $30 · U.S. $50 · $13
- Printed dates
- 1996
- Languages
- English
PDF page 3
A R T I C L E S 5 Generating QuickTime VR Movies From QuickDraw 3D by Pete Falco and Philip McBride QuickTime VR movies don’t have to be created with a real camera; you can instead generate the necessary images with a 3D graphics system like QuickDraw 3D. Here’s how. 29 Flicker-Free Drawing With QuickDraw GX by Hugo M. Ayala This article discusses the causes of flicker in graphics and animation applications and presents a package for doing memory-efficient, flicker-free drawing with QuickDraw GX. 48 NURB Curves: A Guide for the Uninitiated by Philip J. Schneider QuickDraw 3D includes NURB curves among its geometries, but you need to understand a little about the underlying NURB model to use them effectively. This intuitive treatment of NURB curves tells you what you need to know. 78 Using C++ Exceptions in C by Avi Rappoport Exceptions in C++ provide a powerful and useful way to handle errors and other unexpected conditions. But C programmers can take advantage of them as well, since C is (mostly) a subset of C++. 90 Country Stringing: Localized Strings for the Newton by Maurice Sharp Although version 1.5 of the Newton Toolkit provides some built-in support for localizing strings, organizing the different sets of strings is still problematic. Or rather, it was until now. C O L U M N S 26 PRINT HINTS QuickDraw GX Breaks the Space Hack by Dave Polaschek With QuickDraw GX around, downloading fonts to PostScript printers is a little different. 44 GRAPHICAL TRUFFLES The Display Manager by Mike Marinkovich The Display Manager simplifies gathering information about the computer’s displays, and also lets you track changes made by the user. 75 ACCORDING TO SCRIPT Properties and Preferences by Cal Simone Some advice on two problematic areas of scripting support. 87 MPW TIPS AND TRICKS Using ToolServer From CodeWarrior by Tim Maroney Combining ToolServer with CodeWarrior’s new plug-in compiler architecture proves fruitful. 99 NEWTON Q & A: ASK THE LLAMA Answers to Newton-related development questions; you can send in your own. 103 THE VETERAN NEOPHYTE Killing Time Killers by Bo3b Johnson Are computers taking up too much of your time? Here are some tips to help get it back. 108 MACINTOSH Q & A Apple’s Developer Support Center answers queries about Macintosh product development. 117 KON & BAL’S PUZZLE PAGE Printing, Patching, and Fonts by Dave Hersey and Cameron Esfahani Is there no end to the mystery, intricacy, and depth of the Macintosh? Apparently not. Issue 25 March 1996 CONTENTS 1 2 EDITOR’S NOTE 3 LETTERS 123 INDEX
- Printed dates
- March 1996
- Languages
- English
PDF page 4
I’d like to make some general comments on user interface that I’ve been collecting for a while. Please understand I don’t claim to be an expert on the subject — and, as always, the usual disclaimer applies that my opinions aren’t necessarily those of Apple Computer the corporate entity. I’m just one person who has the luxury (as well as the burden) of filling an editorial page, and this is what’s on my mind. First I’d like to make a pitch for a more obvious and responsive channel for users to give feedback on the experience of working with your software: What bugs them about it? Do they have suggestions for improvement? It seems that such feedback gets lost if it’s delivered through the usual customer support (bug-reporting) vehicle. Or maybe it gets delivered to the wrong person, like the engineer who designed and implemented that feature in the first place and can give 99 excellent reasons for why it was done that way. When I first returned to Apple from NeXT and had to use a lot of new applications, I encountered a number of interface glitches that were short of being bugs but made using the applications unnecessarily awkward. I suggested a few simple fixes through the customer support line, sensing some interest but the assignment of a low priority. Alas, those annoying features are all still there five years and a couple of upgrades later. This ties in with a peeve that I share with many of my computer-using friends who don’t work in this industry and so have that valuable perspective of a pure end user: Please avoid making spurious interface “improvements” that change the basic way I work with your application. Be sure there’s a real benefit to the user before you change command names, rearrange them in menus, or put new features in my face rather than making them options I can explore at will. You may think you’re making the interface friendlier, but in fact you may be alienating your existing customer base. The changes that I most appreciate are those that smooth out the rough spots of the interface as it is, so that, for example, I won’t have to resize every mail window to fit my screen, or select the text in the Find box every time I do a new search. I want these nuisances eliminated; instead, I find the upgrade to be just another big nuisance. We interrupt this list of grievances to announce another list we just learned about: develop has been chosen by Internet Valley, Inc. as one of the top 100 computer-related magazines and journals on the Web (http://www.internetvalley.com/top100mag.html). I’m happy enough about this to quit my griping about user interface for now — though I do see a tie-in here: we’ve always encouraged and responded to comments from our readers, and we’ve tweaked our content and format accordingly rather than done a complete overhaul. Thanks for all the valuable feedback over the years; please keep it coming so that we can keep improving. CAROLINE ROSE d e v e l o p Issue 25 March 1996 2 EDITOR’S NOTE CAROLINE ROSE (AppleLink CROSE) has been a technical editor for so long that she says she can do it with her eyes closed. And that’s exactly what she did after being felled by a detached retina during her last vacation. Lying down for over two weeks with her lids shut and not much to do except listen to books on tape, she welcomed the occasional phone call on a develop-related editorial question. Getting back to work and realizing how much catching up she had to do was a real eye-opening experience.• Caroline Rose Editor
Reading notes: Headline not clearly identified in the supplied copy; primary heading left null Reading order of the magazine text is uncertain between the editorial column and the sidebar
- Printed product names
- Apple Computer · NeXT · develop
- Printed dates
- March 1996 · 1996 · Issue 25
- Languages
- English
PDF page 5
WEB FIRST, THEN PRINTED COPY develop is absolutely the coolest publication for a Mac developer. I thought I would drop a line to say “thanks” for putting the next issue up on the Web a full month before it will arrive at my home. At least this way I can get a partial fix! Good job! — Rob Newberry I just noticed that you’ve released develop Issue 24 online. I’m a subscriber, yet I have to call or send e-mail to you each time to remind you to send my issue! Your magazine is terrific, but the service is quite the opposite. — Carl Limisco As a service to developers who may want access to content as soon as it’s finalized, develop content is uploaded to the Web within three days of issue completion. The print and CD-ROM production processes, however, consume more time and thus result in the delay between when you may first see content on the Web and when you receive your copy with its CD in the mail. In the case of Issue 24, this period was extended due to technical difficulties with generating the mailing information. Starting with Issue 23, we switched to APDA for distribution of develop . There have been a few snags in the transition, but we’re confident that subscribers will experience improved service. Meanwhile, we apologize for any problems. — Diane Wilcox PUZZLE PAGE SLIP-UP When I received develop Issue 24, I was shocked to find a bug in the Puzzle Page. When BAL is explaining how LockPixels and UnlockPixels work, he mentions that the PixMap baseAddr can be either a handle or a pointer, and that a flag in rowBytes identifies which state the baseAddr is in. This is wrong; that information is stored in the pmVersion field of the PixMap. There aren’t any bits to spare in rowBytes. Other than that, it was a great Puzzle Page, as usual. — Cameron Esfahani You’re right; you caught this slip-up by the puzzlemeisters themselves. Say, if you’re so good, why not write your own Puzzle Page? [Readers: See the puzzle Cameron coauthors in this issue.] — Caroline Rose MULTIPANE FIXES — AND ABOUT USING OUR CODE The code accompanying Norman Franke’s article on multipane dialogs ( develop Issue 23) is great. I had it up and running in a PowerPlant application in less than an hour. But I found some bugs; for example, in the routines T2PMPDAction and friends, you lock down theData, and I suspect you should be locking down tmpData. Before I get down and dirty, I was wondering if you knew of any other bugs already present. Also, the code needs an extra routine to generate the data handle without displaying the dialog so that one might set the initial values (as opposed to using factory defaults). LETTERS LETTERS 3 SEND US YOUR EXCUSE FOR NOT WRITING Well, actually, we’d rather receive letters regarding articles published in develop. Letters should be addressed to Caroline Rose — or, if technical develop-related questions, to Dave Johnson — at AppleLink CROSE or JOHNSON.DK (Internet crose@applelink.apple.com or dkj@apple.com). All letters should include your name and company name as well as your address and phone number. Letters may be excerpted or edited for clarity (or to make them say what we wish they did). Please send all subscription-related queries to AppleLink APDA (Internet apda@applelink.apple.com).•
Reading notes: Printed date '2024' not found in supplied copy; remove if unsupported Reading order of letter sections may be ambiguous due to layout fragmentation
- Printed product names
- develop · PowerPlant · PixMap · LockPixels · UnlockPixels · CD-ROM · AppleLink
- Printed dates
- Issue 24 · Issue 23
- Languages
- English
PDF page 6
When I get the PowerPlant classes working and debugged, I’d like to distribute them on the Internet (free). May I include your code (possibly modified)? Again, thanks for a great article. — Gordon Watts Norman has provided a newer version of his code as of Issue 24’s CD. He’s fixed a lot of bugs and also now provides PowerPlant classes; see the README file for details. You may redistribute the MPDialogs source if you like, as long as it’s part of your own thing and not just a redistribution of the original package. For instance, you’ll probably not be distributing Norman’s sample or its source, but just the files MPDialogs.c and MPDialogs.h. Please include a pointer to where they came from, since presumably the code will change over time (bug fixes and so on). By the way, you can contact Norman directly at franke@eworld.com. — Dave Johnson d e v e l o p Issue 25 March 1996 4 The observant among you will notice a change in Technical Notes on this issue’s CD (and on the World Wide Web and the other myriad places where they can be found). The old Macintosh Technical Notes are still around, but now there are also new Notes, going simply by the name “Technotes.” The old Notes will eventually evolve into the new scheme. We talked with Technote leader Tom Maremaa, from Apple’s Developer Technical Support group, for the scoop on this. “The old Notes have a rich and varied history at Apple, and have served developers well in the past,” Tom said. “We wanted to continue that tradition –– but with changes, something on the order of Technotes: The Next Generation.” First, Tom hopes you’ll agree that the biggest improvement is in the quality of the new Technotes. They receive far more review by Apple engineers than the old Notes did, and they’re better edited and formatted, so you should find them a lot more readable and reliable. Technotes will also be timelier: more of them will focus on hot new technologies, such as QuickTime VR and QuickDraw 3D, with updates and additions posted regularly on the Web at http://dev.info.apple.com/technotes/Main.html. They’ll migrate to develop’s CD and other such locations, but you’ll no longer have to wait that long for the latest and greatest information. You’ll notice that Technotes are numbered sequentially, starting from 1001, rather than divided into functional categories. Tom found that placing a Note into a single category was becoming increasingly difficult and arbitrary; often a topic would span more than one category or wouldn’t quite fit into any existing category. Locating a Note on a particular subject is easier than ever thanks to the improved searching tools that are now available: you can use Acrobat’s search mechanism on the CD or the excellent search facility provided on Apple’s Web pages. “Providing developers with the ability to search fast and effectively through the whole body of Technotes, particularly on the Web,” said Tom, “has been a major goal in the project. It’s there now. Check it out!” The old Macintosh Technical Notes are gradually being cleaned up: over time they’ll be updated and worked into the new scheme, or deleted if obsolete. Should you look for an old Note by category and number, you’ll find a “stub” indicating its current status if it’s been revised or removed. In particular, the old Q&A Technical Notes are being discontinued; new Q&As are being released as “Macintosh Technical Q&As” (they’re on the Web at http://dev.info.apple.com/techqa/Main.html). For those of you who like to have Notes in printed form, you can still order a printed copy (of both the old and the new Notes). See the Technotes Web page or the latest Apple Developer Catalog for details. Finally, Tom would like to point out that Technotes can be submitted by outside authors (although Caroline asks that you first consider whether develop might be a more appropriate vehicle for your handiwork :-). If your Note is published, you’ll receive YATS (Yet Another T-Shirt) along with some other goodies, including a chance to participate in Apple developer kitchens and other special events. For more information, or just to let us know what you think of all these changes, write to AppleLink DEVFEEDBACK (devfeedback@applelink.apple.com). TECHNOTES AND Q&AS: BETTER THAN EVER
Reading notes: Reading order of the two columns on page 4 may be uncertain The Technotes URL and email address may contain line-break artifacts
- Printed product names
- PowerPlant · MPDialogs · QuickTime VR · QuickDraw 3D · Acrobat · Macintosh Technical Q&As
- Printed dates
- Issue 24 · Issue 25 · March 1996
- Languages
- English
PDF page 7
Generating QuickTime VR Movies From QuickDraw 3D
QuickTime VR is a new technology from Apple that provides users with a virtual reality experience through interactive panoramic and object movies. You can generate images for QuickTime VR movies with either a real camera or a three-dimensional rendering system such as QuickDraw 3D. Here you’ll learn how to create images from QuickDraw 3D models and generate movies from these images with the QuickTime VR Authoring Tools Suite version 1.0. QuickTime VR lets you create two kinds of interactive virtual reality movies: panoramic movies and object movies . In a panoramic movie, users can interactively view a scene at nearly all camera angles from a particular point in space, which gives them the impression of being there and looking around. In an object movie, users can interactively spin an object around and thereby see it from all sides. Panoramic and object movies can be linked together or used separately. QuickTime VR has several advantages over three-dimensional modeling systems for making interactive movies. Its movie files are much smaller than complex 3D models in situations where complete interactivity with the scene isn’t necessary, or where the scene contains complex objects or large numbers of textures. With QuickTime VR, the complexity of the scene and the number of textures used are irrelevant to runtime performance, so even users with lower-end machines can effectively interact with the scene. Finally, a QuickTime VR scene needs only a few megabytes of free space in memory, much less than the enormous amount of RAM usually taken up by complex 3D scenes. You can create QuickTime VR movies using either digitized images captured from a real camera or synthetic images generated by a 3D rendering system, such as QuickDraw 3D. In this article, you’ll learn how to generate images with QuickDraw 3D and convert them to QuickTime VR movies. To make a panoramic movie, you create a panoramic image from a 3D scene, generate a linear QuickTime movie from the image, and convert the linear movie to an interactive panoramic movie using the PETE FALCO AND PHILIP MCBRIDE Generating QuickTime VR Movies From QuickDraw 3D GENERATING QUICKTIME VR MOVIES FROM QUICKDRAW 3D 5 PETE FALCO (AppleLink FALCOP) is a member of Apple’s QuickTime VR team. Since finishing school at Rensselaer Polytechnic Institute in upstate New York, where he spent the last six years in the rainy, snowy weather of Troy, he’s found the sunny weather of California a welcome treat and vows he’ll never leave this area. His latest projects include working on the next release of QuickTime VR as well as integrating all of Apple’s multimedia technologies with QuickTime VR.• PHILIP MCBRIDE (mcbride@apple.com) has been working on multimedia tools and the underlying media technologies since he’s been at Apple. Most recently this included helping to add QuickTime VR to Apple Media Tool 2.0. While not working with digital multimedia, Philip likes to work with real multimedia by sculpting. In fact, he’s been developing a new product that will involve clay, a mouse, and a bottle of cabernet. The details are sketchy, but he has a cool T-shirt for it.•
Reading notes: Possible running-header text 'GENERATING QUICKTIME VR MOVIES FROM QUICKDRAW 3D 5' interleaved with body text; reading order may be affected.
- Printed product names
- QuickTime VR · QuickDraw 3D · QuickTime VR Authoring Tools Suite version 1.0 · Apple Media Tool 2.0 · QuickTime
- Languages
- English
PDF page 8
QuickTime VR Authoring Tools Suite (ATS). (The ATS is a set of tools that you use from within MPW, the Macintosh Programmer’s Workshop.) To create an object movie, you generate a series of images from a 3D model, add the images to a linear QuickTime movie, and then use the QuickTime VR ATS to convert the linear movie to an interactive object movie. Before we get into the specifics of making movies, we’ll explore the basic concepts of QuickTime VR. We assume you have a general understanding of QuickDraw 3D, which you can get by reading “QuickDraw 3D: A New Dimension for Macintosh Graphics” in develop Issue 22 and “The Basics of QuickDraw 3D Geometries” in develop Issue 23. You can learn all about QuickDraw 3D in the book 3D Graphics Programming With QuickDraw 3D . This issue’s CD contains all the code necessary to generate panoramic images and linear object movies from QuickDraw 3D models. For brevity, the listings in the article omit error handling; the code on the CD includes the complete versions of these functions. QUICKTIME VR BASICS The basic components of QuickTime VR movies are panoramas, nodes, objects, and scenes. • A panorama is an image spanning 360° or less in a real or virtual scene. The image is viewed from a particular location in the scene, called a node . A single-node panoramic movie enables a user to look in all directions from that location. • An object is an interactive item that can be viewed from all angles. Object movies can be linked to panoramic movies in a scriptable authoring environment, enabling a user to pick up and turn the objects from within a panorama. Object movies can also be used independently of panoramic movies. In our case, the object of the movie is generated from a QuickDraw 3D model, which contains a single geometric object (or group of objects); we’ll use the term model in this article to refer to the object in a QuickTime VR object movie. • A scene is a collection of several panoramas or nodes, a panorama with one or more objects, or several panoramas and objects all linked together by interactive hot spots. In a multinode scene, a user can navigate from node to node to move about the scene. SHOOTING AN OBJECT For object movies, you need to photograph the model (or the real object) from all directions, as shown in Figure 1. All vertical camera positions above the center of the model are considered positive, and all positions below it are considered negative. The vertical position with the camera directly above the model looking down at it is called vertical pan 90° ; the vertical position directly below and looking up is called vertical pan -90° . Vertical pan 0° is at the model’s center (equator). Horizontal positions are measured in degrees from horizontal pan 0° to 360° . Horizontal pan 0° is typically at the back of the model. Images must be stored as frames in row order from top to bottom in a linear QuickTime movie. For best results, we (along with the QuickTime VR documentation) recommend that you have a frame every 10° between positions in both the horizontal and vertical direction. If you shoot at increments greater than 10°, the motion of the model in the d e v e l o p Issue 25 March 1996 6
Reading notes: Running page header and footer text ('develop Issue 25') interrupts the body copy and may not belong to the reading order.
- Printed product names
- QuickTime VR Authoring Tools Suite · QuickDraw 3D · QuickTime VR · QuickTime · 3D Graphics Programming With QuickDraw 3D · Macintosh Programmer’s Workshop
- Printed dates
- March 1996
- Languages
- English
PDF page 9
QuickTime VR movie will be choppier when the user turns it. If you shoot at increments of less than 10°, the motion will be smoother, but you’ll need more disk space to store all the frames. Whatever increment you choose, it should be consistent between all horizontal and vertical frames for the object and divide evenly into the horizontal and vertical pan ranges. Your first frame at each horizontal position should be of the back of the model, so that the frame showing the front of the model is halfway through the series at that horizontal position. This improves disk access time at run time since the user will most likely be looking at the front of the model. SHOOTING A PANORAMA If you’re using a real camera to shoot a panorama, you need to take the appropriate number of equally spaced pictures in a circle, as shown in Figure 2. Although this sounds simple, there are a few things you must be aware of. First, you need to make sure you’re taking the right number of shots for the lens you’re using (see Chapter 6 in Volume 1 of the QuickTime VR ATS documentation for a full explanation of this). The entire camera rig should be level at all times, and the nodal point of the lens should be directly over the point of rotation of the rig. For best GENERATING QUICKTIME VR MOVIES FROM QUICKDRAW 3D 7 90 ° –90 ° 0 ° Horizontal pan Vertical pan Figure 1. Shooting a model (or a real object) Figure 2. Shooting a panorama
Reading notes: Running header 'GENERATING QUICKTIME VR MOVIES FROM QUICKDRAW 3D' and page number 7 appear mid-text, may affect reading order. Figure captions and diagram labels are presented inline without their graphics, so their placement is uncertain.
- Languages
- English
PDF page 10
results, you should also have a consistent overlap between images; the more overlap, the better (30% to 50% is recommended). Finally, you should maintain consistency between images in each panorama by using similar exposure and a fixed focus. Because this can get quite complicated, Apple strongly recommends the use of a professional photographer for making any production-quality titles. However, one way around this is to use rendered data, as we do in this article. The programmatic control we have over the “virtual” camera in a 3D environment such as QuickDraw 3D eliminates all of the problems just mentioned. MAKING MOVIES WITH THE SAMPLE CODE The sample code on this issue’s CD enables you to make object and panoramic movies from any 3DMF file (a file that conforms to the QuickDraw 3D Object Metafile standard). For either type of movie, the code creates a new document record structure, reads in the model from a 3DMF file, renders the images, and writes out the images in a form that the QuickTime VR tools can work with. Here we’ll look at the first few steps, which are common to both types of movies. The other steps for making QuickTime VR movies — rendering and writing out the images and converting linear movies to interactive movies — are different for object and panoramic moviemaking and are described later. CREATING A NEW DOCUMENT All of our scene information is stored in a document record structure, shown in Listing 1. The MyNewDocument function (Listing 2) creates the document record structure and sets up the view, camera, and other elements associated with the scene. It also adds the background buffer and window used to display the rendered images of the scene. CREATING THE CAMERA The camera used to render the images for the movies is created by the MyNewCamera function, shown in Listing 3. For object movies, we set the field of view to approximately 30°. This is not a fixed number; you can use any number that you see fit, based generally on the aspect ratio of your viewing window and how much information you’d like to display inside it. d e v e l o p Issue 25 March 1996 8 Listing 1. The document record structure for a scene typedef struct _DocumentRecord { CWindowPtr theWindow; // Display window FSSpec theFileSpec; // Model file specification short fRefNum; // and reference GWorldPtr drawContextOffScreen; // Offscreen buffer TQ3GroupObject documentGroup; // Main group for the document TQ3ViewObject theView; // The document's view object TQ3Matrix4x4 modelRotation; // The model transform TQ3Point3D documentGroupCenter; // Center of the model ... // Miscellaneous view, model, and QuickTime file details } DocumentRecord, *DocumentPtr, **DocumentHandle;
- Printed product names
- QuickDraw 3D · QuickTime VR
- Printed dates
- March 1996 · Issue 25
- Languages
- English
PDF page 11
GENERATING QUICKTIME VR MOVIES FROM QUICKDRAW 3D 9 Listing 2. Creating a new document record structure DocumentPtr MyNewDocument() { DocumentPtr theDocument; CWindowPtr theWindow; TQ3DrawContextObject theDrawContext; Rect myBounds = kMyBoundsRect; TQ3CameraObject camera = NULL; RGBColor blackColor = kMyBlackColor; ... theDocument = (DocumentPtr)NewPtrClear(sizeof(DocumentRecord)); // Create the window for the document record and add references to // the document record. theWindow = (CWindowPtr)NewCWindow(0L, &myBounds, "\pRendering Window", true, documentProc, (WindowPtr)-1L, true, NULL); theDocument->theWindow = theWindow; // Create and set up the offscreen GWorld/context. // ** Notice that QuickDraw 3D prefers direct color. ** NewGWorld(&theDocument->drawContextOffScreen, 32, &theWindow->portRect, nil, nil, 0L); ... SetGWorld(theDocument->drawContextOffScreen, nil); EraseRect(&theDocument->drawContextOffScreen->portRect); ... // Create the new pixmap draw context. theDrawContext = MyNewDrawContext(theDocument); // Create the view and set up the view attributes. ... // Initialize the model rotation and transitions used for object // movie rotations. Q3Matrix4x4_SetIdentity(&theDocument->modelRotation); // Add more model and view properties to the document record. ... // Create the camera and add it to the view. camera = MyNewCamera(theDocument->theWindow); Q3View_SetCamera(theDocument->theView, camera); Q3Object_Dispose(camera); // Add the renderer to the view. Set the window's GWorld. Q3View_SetRendererByType(theDocument->theView, kQ3RendererTypeInteractive); SetGWorld(theWindow, nil); return (theDocument); }
- Languages
- English