Requirements

Prerequisite knowledge

Familiarity working with the Stage3D API and basic understanding of how it is structured is required. Before completing this tutorial, be sure to follow along with the previous tutorials in this series on Stage3D:

User level

Beginning

 

Required products

Flash Builder (Download trial)

Adobe Animate CC

Adobe AIR

 
Introduction

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.
 

 
Wireframe mode

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:
 
context3D.setFillMode(Context3DFillMode.WIREFRAME);
 
By default the value of Context3DFillMode is SOLID.Wireframe mode can be used in ActionScript with the following code:
 
import flash.display3D.Context3DFillMode;
 
// include package flash.display3D.Context3DFillMode
 
var context3D:Context3D;
 
//make a Context3D instance
 
context3D.setFillMode(Context3DFillMode.WIREFRAME);
 
//call method setFillMode()
 
Following are the images showing Stage3D render Solid mode view and Wireframe mode view:
 
Solid mode

Solid mode

 

Wireframe mode

Wireframe mode

 

 
Advantages of using wireframe mode

  • 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). 

 
Support for wireframes

  • 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.
 

 
Where to go from here

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.