Table of contents
4 November 2015
In this article we will learn to use Stage3D wireframe mode support in ActionScript application based on the Stage3D API. Wireframe is used to view the Stage3D rendered objects in wireframe mode instead of solid objects.
A wireframe is used to represent a solid object by a mesh of lines rather than solid shaded polygons.
Wireframe models are usually rendered faster and can be used to view both the front and back of an object at the same time.
It helps to provide a detailed view of the whole scene and make their operation (select, drag, scale, and so on) more convenient.
If wireframe mode is set, we can see each triangle in Stage3D rendering.
Context3DFillMode has two values:
- WIREFRAME- The object will be shown in a mesh of lines.
- SOLID- The object will be shown in solid shaded polygons.
To use 3D render fill mode as wireframe, call method setFillMode() , setFillMode of a Context3D instance and set value as WIREFRAME of class Context3DFillMode (Context3DFillMode) , as shown here:
By default the value of Context3DFillMode is SOLID.Wireframe mode can be used in ActionScript with the following code:
// include package flash.display3D.Context3DFillMode
//make a Context3D instance
//call method setFillMode()
Following are the images showing Stage3D render Solid mode view and Wireframe mode view:
- Wireframe can be used to find out objects that may be covered by other objects and make modifications to them.
- Wireframe makes it easy to catch some problems (such as a vertex that is in the wrong position).
- Wireframe mode is implemented in AIR 16 and above, and is available in AIR desktop only.
- Wireframe is not supported in SOFTWARE rendering mode and is available with rendering profiles BASELINE and above (Request context3D)
To use wireframe mode in Action Script code, download Flash Builder project WireframeSample.zip (attached as sample file on the top of this page) and import it in Flash builder.
From here on as you use wireframe mode with Stage3D apps, things will only get deeper and more interesting.
To learn more about Stage3D, check out Texture features in Stage3.