?? immediate.html
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Java 3D API - Immediate-Mode Rendering</title></head><body><h2>Immediate-Mode Rendering</h2><p>Java 3D is fundamentally a scene graph-based API. Most ofthe constructs in the API are biased toward retained mode andcompiled-retained mode rendering. However, there are some applicationsthat want both the control and the flexibility that immediate-moderendering offers.</p><p>Immediate-mode applications can either use or ignore Java 3D'sscenegraph structure. By using immediate mode, end-user applications havemore freedom, but this freedom comes at the expense of performance. Inimmediate mode, Java 3D has no high-level information concerninggraphical objects or their composition. Because it has minimal globalknowledge, Java 3D can perform only localized optimizations onbehalfof the application programmer.</p><p></p><h2>Two Styles of Immediate-ModeRendering</h2>Use of Java 3D's immediate mode falls into one of two categories:pureimmediate-mode rendering and mixed-mode rendering in which immediatemode and retained or compiled-retained mode interoperate and render tothe same canvas. The Java 3D renderer is idle in pure immediatemode,distinguishing it from mixed-mode rendering.<h3>Pure Immediate-ModeRendering</h3>Pure immediate-mode rendering provides for those applications andapplets that do not want Java 3D to do any automatic rendering ofthescene graph. Such applications may not even wish to build a scene graphto represent their graphical data. However, they use Java 3D'sattribute objects to set graphics state and Java 3D's geometricobjectsto render geometry.<hr noshade="noshade"><b>Note:</b> Scene antialiasing is not supportedin pure immediate mode.<hr noshade="noshade">A pure immediate mode application must create aminimal set of Java 3Dobjects before rendering. In addition to a Canvas3D object, theapplication must create a View object, with its associated PhysicalBodyand PhysicalEnvironment objects, and the following scene graphelements: a VirtualUniverse object, a high-resolution Locale object, aBranchGroup node object, a TransformGroup node object with associatedtransform, and, finally, a ViewPlatform leaf node object that definesthe position and orientation within the virtual universe that generatesthe view (see <a href="#Figure_1">Figure1</a>).<p><a name="Figure_1"></a><img style="width: 500px; height: 359px;" alt="Minimal Immediate-Mode Structure" title="Minimal Immediate-Mode Structure" src="Immediate1.gif"></p><p></p><ul> <font size="-1"><b><i>Figure 1</i> – Minimal Immediate-Mode Structure</b></font></ul><p>Java 3D provides utility functions that create much of thisstructureon behalf of a pure immediate-mode application, making it lessnoticeable from the application's perspective-but the structure mustexist.</p><p>All rendering is done completely under user control. It is necessaryfor the user to clear the 3D canvas, render all geometry, and swap thebuffers. Additionally, rendering the right and left eye for stereoviewing becomes the sole responsibility of the application.</p><p>In pure immediate mode, the user must stop the Java 3Drenderer, viathe Canvas3D object <code>stopRenderer()</code>method, prior to adding the Canvas3D object to an active View object(that is, one that is attached to a live ViewPlatform object).</p><p></p><h3>Mixed-Mode Rendering</h3>Mixing immediate mode and retained or compiled-retained mode requiresmore structure than pure immediate mode. In mixed mode, theJava 3Drenderer is running continuously, rendering the scene graph into thecanvas.<p>The basic Java 3D <em>stereo</em> rendering loop, executed foreachCanvas3D, is as follows:</p><pre><hr><br>clear canvas (both eyes)<br></pre><pre>call preRender() <strong><kbd>// user-supplied method<br></kbd></strong>set left eye view<br>render opaque scene graph objects<br>call renderField(FIELD_LEFT) <strong><kbd>// user-supplied method<br></kbd></strong>render transparent scene graph objects<br>set right eye view<br>render opaque scene graph objects again<br>call renderField(FIELD_RIGHT) <strong><kbd>// user-supplied method<br></kbd></strong>render transparent scene graph objects again<br>call postRender() <strong><kbd>// user-supplied method<br></kbd></strong>synchronize and swap buffers<br></pre><pre>call postSwap() <strong><kbd>// user-supplied method<br></kbd></strong><br><hr></pre>The basic Java 3D <em>monoscopic</em> rendering loop is asfollows:<pre><hr><br>clear canvas<br></pre><pre>call preRender() <strong><kbd>// user-supplied method<br></kbd></strong>set view<br>render opaque scene graph objects<br>call renderField(FIELD_ALL) <strong><kbd>// user-supplied method<br></kbd></strong>render transparent scene graph objects<br>call postRender() <strong><kbd>// user-supplied method<br></kbd></strong>synchronize and swap buffers<br></pre><pre>call postSwap() <strong><kbd>// user-supplied method<br></kbd></strong><br><hr></pre>In both cases, the entire loop, beginning with clearing the canvas andending with swapping the buffers, defines a frame. The application isgiven the opportunity to render immediate-mode geometry at any of theclearly identified spots in the rendering loop. A user specifies his orher own rendering methods by extending the Canvas3D class andoverriding the <code>preRender</code>, <code>postRender</code>, <code>postSwap</code>,and/or <code>renderField</code> methods.</body></html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -