Blank screen instead of basic 3D stage in tutorial example

Software: Away3D 4.x

Tig, Newbie
Posted: 18 February 2015 04:25 PM   Total Posts: 5

I need some assistance, please..

I am new (this day) to Away3D. I’ve been trying to do the simplest of tutorials (“Setting up your scene”) and yet, it’s not working.. All I’m getting is a black screen. I’ve moved on from earlier, where all I had was the stage colour..

I am publishing with Air SDK 16 (the latest), using Flash CC 2014, trying to test both locally and on an iPad Mini and I’ve already inserted the “DepthAndStencil” doodad to the *-app.xml. I’m using Away3D 4.x as well.

I’ve tried a number of things and am finally resorting to seeking help here as I haven’t been able to find anything on the web..


Here is my code:

package 
{
 import flash
.display.Sprite;
 
import flash.events.Event;
 
 
import away3d.containers.View3D;
 
import away3d.entities.Mesh;
 
import away3d.materials.TextureMaterial;
 
import away3d.primitives.PlaneGeometry;
 
 
import flash.geom.Vector3D;
 
 public class 
Video3D extends Sprite
 {
  
private var _view:View3D;
  private var 
_plane:Mesh;
  
  public function 
Video3D():void 
  {
   
if (stageinit();
   else 
addEventListener(Event.ADDED_TO_STAGEinit);
  
}
  
  
private function init(e:Event null):void  {
   removeEventListener
(Event.ADDED_TO_STAGEinit);
   
// entry point
   
   //setup the view
   
_view = new View3D();
   
addChild(_view);
   
   
//setup the camera
   
_view.camera.= -600;
   
_view.camera.500;
   
_view.camera.lookAt(new Vector3D());
   
   
//setup the scene
   
_plane = new Mesh(new PlaneGeometry(700700));
   
_view.scene.addChild(_plane);
  
}
 }
 

 

   

Avatar
Fabrice Closier, Administrator
Posted: 18 February 2015 07:07 PM   Total Posts: 1265   [ # 1 ]

You might need to say the magic word… _view.render();

also, it is a good practice for dev to addChild a new Trident this way your lookat will be helping you visually, for instance, if the plane has the normals pointing otherway, you will not see anything on screen, while you will always see the trident at 0,0,0.

   

Tig, Newbie
Posted: 19 February 2015 10:05 AM   Total Posts: 5   [ # 2 ]

Ah… That wasn’t in the first part of the tutorial. red face Knew it was going to be a silly question..

Okay. A more logical question, if you will.

I have put the _view.render(); line in immediately after the _view.scene.addChild(_plane); line. When I publish this, I still get a black screen. If I put _view.render() in an ENTER_FRAME function or if I use a TweenMax.delayedCall, the scene renders.

Why can I not have the scene render immediately after the view is created?


PS ~ Thank you for the trident advice! I’m sure I will find that very useful..

   

Avatar
Fabrice Closier, Administrator
Posted: 19 February 2015 10:48 AM   Total Posts: 1265   [ # 3 ]

By just adding a render after the view is addChilded and its scene populated, it should. The view renders when a context is available. You must have something in your setup that prevents this to happend during the first single iteration.

   

Tig, Newbie
Posted: 19 February 2015 12:10 PM   Total Posts: 5   [ # 4 ]

Well, you can see my code.. is there something in there that would prevent the rendering? Or is that something at the publish point?

I’m trying to publish for iPad, if this affects how I should be going about this..

I have additional questions about video textures, but I’ll make a new post about that..!

Thank you for your assistance smile

   

Pierce, Jr. Member
Posted: 20 February 2015 12:21 AM   Total Posts: 40   [ # 5 ]

try listening for this and then rendering?

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Stage3D.html#event:context3DCreate

hope that helps.

   

bradg, Newbie
Posted: 27 February 2015 12:40 PM   Total Posts: 4   [ # 6 ]

Tig, did you figure this out?

I’m having the exact same problem. I can get the 3D scene to render on the PC, but not on the iPad2.

I did a _view.render(); after setting up the scene.

I’m also listening for the context3DCreate event, which I get and then add some text to a TextField for verification that the event happened.

Anyone else care to offer some advice to us Newbies?

   

Tig, Newbie
Posted: 09 March 2015 10:45 AM   Total Posts: 5   [ # 7 ]

Hi bradg

Yes, I did get this to work. There are two things you may have to do (if you are still having trouble)

First:
Copy the line

<depthAndStencil>true</depthAndStencil
between the
<initialWindow

tags.

Second:
When publishing, make sure your ios publish setting for Render mode is set to Direct

Hopefully this works for you..

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X