Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 19 in printed book and digital formats -- plus a one-year subscription (beginning with 20.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 1.6


Quesa Declares

3D graphics beyond the usual limits

Issue: 1.6 (June/July 2003)
Author: Joe Strout
Author Bio: Joe Strout sometimes grows tired of thinking outside the box, and suggests that we instead simply make the box more interesting.
Article Description: No description available.
Article Length (in bytes): 33,732
Starting Page Number: 22
Article Number: 1612
Resource File(s):

Download Icon 1612.zip Updated: 2013-03-11 19:07:56

Related Web Link(s):


Excerpt of article text...

REALbasic provides built-in support for real-time 3D graphics. You can load model files or create 3D objects from pictures, then scale them, rotate them, and move them around. This is all quite easy to do and the classes and methods involved are simple.

But that simplicity comes with a cost: it may not provide for everything you ever need to do. What happens then? Are you simply out of luck, forced to use some completely different approach to 3D?

If the answer were "yes," this would be a short article indeed. But of course that's not the case. RB's 3D functionality is built upon powerful libraries (QuickDraw 3D on classic MacOS, Quesa on other platforms), to which you can speak directly using Declare statements. RB provides all the hooks you need to make the Declare functionality and the standard RB functionality work together seamlessly. It is surprisingly easy -- in most cases, it takes only a handful of Declares to solve a particular problem, and the rest of your app is just standard built-in RB goodness.

When might you need to delve into Declares? A typical case would be when you need to display objects whose shapes are not known until run-time. For example, suppose you're trying to make a 3D bar chart. The length of each bar depends on runtime data, so you can't just load a pre-designed model. Scaling a standard box model won't work, because that scales uniformly in all three dimensions; we only want to change the height.

One possible solution would be to construct a 3DMF string at runtime that represents the box you need. If the data isn't rapidly changing, that will work fine. But suppose you want an animated bar chart -- like a graphic equalizer on a sound system. The bars in such an app would be changing height on every frame. To use the 3DMF solution, you'd have to destroy the previous bars and create new ones each frame, which will result in lousy performance. What you really need here is to change the height of each box on the fly. And with standard RB functionality, you just can't do that. But with a few Declares you can do this and much more.

...End of Excerpt. Please purchase the magazine to read the full article.