Slowdown FPS in FULLSCREEN mode

Software: Away3D 4.x

djuzeppa, Newbie
Posted: 11 June 2013 12:41 PM   Total Posts: 1

Hi,
I made a simple example of a rolling ball, and it works fine (60fps) in normal mode, but when i switch it to fullscreen, frame rate drops to 30-40. Why is this happening, I have only one sphere and one plane on the scene(AwayStats: 484poly), even without lighting and shadows.

package{
 import away3d
.cameras.Camera3D;
 
import away3d.cameras.lenses.PerspectiveLens;
 
import away3d.containers.Scene3D;
 
import away3d.containers.View3D;
 
import away3d.core.managers.Stage3DManager;
 
import away3d.core.managers.Stage3DProxy;
 
import away3d.debug.AwayStats;
 
import away3d.entities.Mesh;
 
import away3d.events.Stage3DEvent;
 
import away3d.materials.TextureMaterial;
 
import away3d.primitives.PlaneGeometry;
 
import away3d.primitives.SphereGeometry;
 
import away3d.utils.Cast;
 
 
import flash.display.Sprite;
 
import flash.display.StageAlign;
 
import flash.display.StageDisplayState;
 
import flash.display.StageScaleMode;
 
import flash.events.Event;
 
import flash.events.MouseEvent;
 
import flash.geom.Matrix3D;
 
import flash.geom.Vector3D;
 
 
[SWF(width="1024"height="512"frameRate="60")]
 
public class OneBallTest extends Sprite{
  
  [Embed
(source='eight.png')]
  
private var BallTexture:Class;
  
[Embed(source='ballShadow.png')]
  
private var ShadowTexture:Class;
  
  private var 
stage3DManager:Stage3DManager;
  private var 
stage3DProxy:Stage3DProxy;
  private var 
view:View3D;
  private var 
shadowMaterial:TextureMaterial;
  private var 
sphereMaterial:TextureMaterial;
  private var 
shadow:Mesh;
  private var 
sphere:Mesh;
  
  private var 
oldX:Number=0;
  private var 
oldY:Number=0;
  private var 
curX:Number=0;
  private var 
curY:Number=0;
  private var 
angle:Number=0;
  
  public function 
OneBallTest(){
   stage
.scaleMode StageScaleMode.NO_SCALE;
   
stage.align StageAlign.TOP_LEFT;
   
stage3DManager Stage3DManager.getInstance(stage);
   
stage3DProxy stage3DManager.getFreeStage3DProxy();
   
stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATEDonCreate);
  
}
  
private function onCreate(e:Stage3DEvent):void{
   view 
= new View3D();   
   
view.stage3DProxy stage3DProxy;
   
view.shareContext true;
   
view.antiAlias 4;
   
view.width  1024;
   
view.height 512;
   
view.camera = new Camera3D();
   
view.scene  = new Scene3D();
   
view.stage3DProxy.color 0xFFFFFF;
   
   
shadowMaterial = new TextureMaterial(Cast.bitmapTexture(new ShadowTexture()), truefalsefalse);
   
shadowMaterial.alphaBlending true;
   
shadow = new Mesh(new PlaneGeometry(323211truetrue), shadowMaterial);
   
shadow.position = new Vector3D(009);
   
shadow.rotationX 90;
   
view.scene.addChild(shadow);
   
   
sphereMaterial = new TextureMaterial(Cast.bitmapTexture(new BallTexture()), truefalsefalse);
   
sphere = new Mesh(new SphereGeometry(91616), sphereMaterial);
   
sphere.position = new Vector3D(000);
   
view.scene.addChild(sphere);
   
   var 
dist:Number Vector3D.distance(new Vector3D(0,0,0), view.camera.position );
   var 
fieldOfView:Number  = (360 Math.PI) * Math.atan(512 / (dist));
   (
view.camera.lens as PerspectiveLens).fieldOfView fieldOfView;
   
   
addChild(new AwayStats(view));
   
addChild(view);
   
   
stage.addEventListener(Event.ENTER_FRAMEenterFrameHandler);
   
stage.addEventListener(Event.RESIZEresizeHandler);
   
stage.addEventListener(MouseEvent.DOUBLE_CLICKclickHandler);
  
}
  
private function clickHandler(e:MouseEvent):void{
   stage
.displayState StageDisplayState.FULL_SCREEN;
  
}
  
private function enterFrameHandler(e:Event):void{
   stage3DProxy
.clear();
   
   
moveBall();
   
view.render();
   
   
stage3DProxy.present();
  
}
  
private function moveBall():void{
   oldX 
curX;
   
oldY curY;
   
angle+=0.1;
   if(
angle>360angle 0;
   
curX 100*Math.sin(angle);
   
curY =-100*(1-Math.cos(angle));
   
   
shadow.x=curX;
   
shadow.y=curY;
   
   
sphere.x=curX;
   
sphere.y=curY;
     
   var 
matrix:Matrix3D sphere.transform.clone();
   
matrix.appendRotation(-(curX-oldX)*2Vector3D.Y_AXISmatrix.position);
   
matrix.appendRotation((curY-oldY)*2Vector3D.X_AXISmatrix.position);
   
matrix.appendRotation(0Vector3D.Z_AXISmatrix.position);
   
sphere.transform matrix;
    
  
}
  
private function resizeHandler(e:Event):void{
   stage3DProxy
.width stage.stageWidth;
   
stage3DProxy.height stage.stageHeight;
   
view.width Math.ceil(stage.stageWidth*0.8);
   
view.height Math.ceil(stage.stageHeight*0.8);
   
view.Math.ceil(stage.stageWidth/2-view.width/2);
   
view.Math.ceil(stage.stageHeight/2-view.height/2);
  
}
 }

any ideas?

Many thanks for considering my request,
p.s. sorry for my english

 

   

Vice, Member
Posted: 03 September 2013 11:28 AM   Total Posts: 58   [ # 1 ]

because its not a real fullscreen mode like this one in directx etc.
in this particular issue, the screen fits to the desktop screen resolution and gpu has to handle a higher resolution e.g.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X