* <b>On-screen Rendering vs. Off-screen Rendering</b>
* <p>
* The Canvas3D class is used either for on-screen rendering or
* off-screen rendering.
* On-screen Canvas3Ds are added to AWT or Swing Container objects
* like any other canvas. Java 3D automatically and continuously
* renders to all on-screen canvases that are attached to an active
* View object. On-screen Canvas3Ds can be either single or double
* buffered and they can be either stereo or monoscopic.
* <p>
* Off-screen Canvas3Ds must not be added to any Container. Java 3D
* renders to off-screen canvases in response to the
* <code>renderOffScreenBuffer</code> method. Off-screen Canvas3Ds
* are single buffered. However, on many systems, the actual
* rendering is done to an off-screen hardware buffer or to a 3D
* library-specific buffer and only copied to the off-screen buffer of
* the Canvas when the rendering is complete, at "buffer swap" time.
* Off-screen Canvas3Ds are monoscopic.
* <p>
* The setOffScreenBuffer method sets the off-screen buffer for this
* Canvas3D. The specified image is written into by the Java 3D renderer.
* The size of the specified ImageComponent determines the size, in
* pixels, of this Canvas3D - the size inherited from Component is
* ignored. Note that the size, physical width, and physical height of the
* associated Screen3D must be set
* explicitly prior to rendering. Failure to do so will result in an
* exception.
屏幕渲染VS非屏幕渲染
Canvas3D 有两种渲染方式 on-screen rendering 和 off-screen rendering
和其他canvas对象一样,通过屏幕渲染方式的 Canvas3D 对象被添加到AWT 或者 Swing 对象中。Java 3D 自动并且持续渲染所有的附加在活动View对象上的canvases 对象。屏幕渲染Canvas3D 对象可以有一个或者两个缓冲区(buffer)并且缓冲区可以是立体对象数据或者平面对象数据。
非屏幕渲染的Canvas3D对象不能被添加到任何容器中。Java 3D通过响应renderOffScreenBuffer方法渲染。
非屏幕对象是单缓冲的。
但是,在很多操作系统中,当渲染完成后,在 “buffer swap”时间段内,渲染数据被放置在一个非屏幕硬件中或者一个3D应用程序包指定的缓冲区中,并且渲染数据只能被拷贝到Canvas对象的非屏幕缓冲区中。
非屏幕渲染的Canvas3D 对象是平面的。
如果通过setOffScreenBuffer 该方法指定渲染buffer ,则ImageComponent 决定Java 3D 渲染后的图像大小。需要注意的是,必须指定图像的物理大小参数,不然会出现程序异常。
我的理解:
1.在非屏幕渲染情况下,Canvas3D对象不能被添加到继承了Container类得任何类所生成的对象中,例如Panel,jframe...
2.非屏幕渲染对象只有一个存储渲染数据的Buffer对象。
3.根据操作系统的不同,渲染数据有可能被放置到硬件缓冲区或者3d应用程序包的缓冲区中,这时就需要将该数据拷贝到Canvas3d对象的缓冲区中,在这种情况下渲染数据只能被拷贝到非屏幕缓冲区。
4.非屏幕渲染的Canvas3D 对象是平面的,可能是由于我们眼睛通过屏幕看到的图像只能是平面图,缓冲区只存储眼睛所能看到的图像数据。