14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13 Three-Dimensional Scenes 429<br />

About JSL 3-D Scenes<br />

About JSL 3-D Scenes<br />

JMP's 3-D scene language is built on top of the OpenGL ® API, extending, replacing, and leaving out<br />

various parts of the OpenGL API, and as such is not an implementation that is certified or licensed by<br />

Silicon Graphics, Inc. under the OpenGL API.<br />

This chapter documents JMP's JSL commands for creating 3-D scenes but is not a tutorial on OpenGL<br />

programming. If you are not familiar with OpenGL programming, you might want supplemental material.<br />

If you are familiar with OpenGL programming, you still need to read this chapter because some items are<br />

nonstandard.<br />

JMP ships with sample files in the Scene3D subfolder of Sample Scripts to get you started and give you<br />

some ideas. Some of the example scripts are similar to some of the examples in this chapter; some are almost<br />

complete applications.<br />

The Web site opengl.org is a good jumping off point for information, as is your favorite search engine.<br />

JMP's Scene 3-D language does some work for you that the OpenGL API requires you to do for yourself.<br />

JMP makes text easy, gives you a built-in arcball controller, and makes sure the matrix operations that<br />

belong on the model view stack and projection stack go on their respective stacks. JMP uses its own display<br />

list manager so your scenes can be journaled and played back later, and provides a pick mechanism that calls<br />

back to your JSL code to tell you what object in your scene is under the mouse, with almost no extra effort<br />

on your part. At this time, JMP does not provide access to some features, like texturing.<br />

OpenGL is a trademark of Silicon Graphics, Inc.<br />

JSL 3-D Scene Boxes<br />

These commands are necessary to set up and configure a 3-D scene.<br />

Like all displays in JMP (detailed in the “Display Trees” chapter on page 329), 3-D scenes must be placed in<br />

a display box (in this case, a Scene Box). This box is then placed in a window. Therefore, a simple 3-D<br />

scene script has the following form.<br />

myScene=Scene Box(300, 300); //create a 300 by 300 pixel scene box<br />

...(commands to set up the scene)...<br />

New Window (“3-D Scene”, myScene); //draw the scene in a window<br />

...(commands that manipulate the scene)<br />

The scene can be sent messages that construct elements in the scene. Typical messages alter the viewer’s<br />

vantage point, construct physical elements in the scene itself, or manipulate lights and textures. These<br />

messages are maintained in a display list and are manipulated in one of two ways:<br />

• They are sent as messages to the scene, which immediately adds them to the scene’s internal display list.<br />

• They are sent as messages to a display list stored in a global variable, which is called by the scene’s display<br />

list later.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!