Comments (4)
Thanks for taking the time to creating that minimal sample!
I found the reason for the problem and describe it here and here.
I'll reopen this issue – I'd prefer for Harman to fix this at the source, but that's not decided yet. If need be, I will add the workaround directly to Starling.
from starling-framework.
Fixed by Harman.
from starling-framework.
I wish I could help, but this is a case where Starling simply uses the texture that's provided by AIR and wraps it in a Starling texture – so if that fails, the problem is very probably happening on a lower level. Thus, opening up the issue in the AIRSDK issue tracker (which you already did) is your best chance to get help. I'm crossing my fingers that you get a response soon!
from starling-framework.
It's strange this code work on Windows :
package
{
import com.adobe.utils.AGALMiniAssembler;
import flash.display.Sprite;
import flash.display.Stage3D;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display3D.Context3D;
import flash.display3D.Context3DProfile;
import flash.display3D.Context3DProgramType;
import flash.display3D.Context3DRenderMode;
import flash.display3D.Context3DVertexBufferFormat;
import flash.display3D.IndexBuffer3D;
import flash.display3D.Program3D;
import flash.display3D.VertexBuffer3D;
import flash.display3D.textures.VideoTexture;
import flash.events.Event;
import flash.events.VideoTextureEvent;
import flash.geom.Matrix3D;
import flash.media.Camera;
import flash.utils.ByteArray;
public final class Main extends Sprite
{
private var stage3D:Stage3D;
private var context3D:Context3D;
//
private var program:Program3D;
private var indexBuffer:IndexBuffer3D;
//
private var videoTexture:VideoTexture;
/**
* Constructor.
*/
public function Main():void
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage3D = stage.stage3Ds[0];
stage3D.addEventListener(Event.CONTEXT3D_CREATE, contextCreateHandler);
stage3D.requestContext3D(Context3DRenderMode.AUTO, Context3DProfile.STANDARD_CONSTRAINED);
}
private function contextCreateHandler(e:Event):void
{
context3D = stage3D.context3D;
//context3D.enableErrorChecking = true;
context3D.configureBackBuffer(stage.stageWidth, stage.stageHeight, 0, true);
// create
createShaders();
setConstant();
setBuffer();
// camera
var camera:Camera = Camera.getCamera();
camera.setMode(stage.stageWidth, stage.stageHeight, 60);
videoTexture = context3D.createVideoTexture();
videoTexture.attachCamera(camera);
videoTexture.addEventListener(Event.TEXTURE_READY, renderFrame);
videoTexture.addEventListener(VideoTextureEvent.RENDER_STATE, videoTexture_renderStateHandler);
}
private function renderFrame(e:Event):void
{
trace("Render on stage3D with VideoTexture Object.");
context3D.clear(0, 0, 0, 1);
context3D.drawTriangles(indexBuffer);
context3D.present();
}
private function videoTexture_renderStateHandler(event:VideoTextureEvent):void
{
context3D.setTextureAt(0, videoTexture);
context3D.setProgram(program);
}
/**
* create Stage3D shader programs.
*/
private function createShaders():void
{
// create shaders
var agalAssembler:AGALMiniAssembler = new AGALMiniAssembler();
// vertex
var vertexShader:ByteArray = agalAssembler.assemble(Context3DProgramType.VERTEX, "m44 op, va0, vc0 \n" + "mov v0, va1\n");
// fragment
var fragmentShader:ByteArray;
var code:Array;
// normal
code = [
"mov ft0 v0",
"tex ft0, ft0, fs0<2d,clamp,linear>",
"mov oc, ft0",
];
fragmentShader = agalAssembler.assemble(Context3DProgramType.FRAGMENT, code.join("\n"));
program = context3D.createProgram();
program.upload(vertexShader, fragmentShader);
}
/**
* set constants for shaders.
*/
private function setConstant():void
{
var mtx:Matrix3D = new Matrix3D();
context3D.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, mtx, false);
}
/**
* create and set buffers for shaders.
*/
private function setBuffer():void
{
// vertex buffer
var vertexBuffer:VertexBuffer3D = context3D.createVertexBuffer(4, 4);
vertexBuffer.uploadFromVector(Vector.<Number>([-1, -1, 0, 1, -1, 1, 0, 0, 1, -1, 1, 1, 1, 1, 1, 0]), 0, 4);
// index buffer
indexBuffer = context3D.createIndexBuffer(6);
indexBuffer.uploadFromVector(Vector.<uint>([0, 1, 2, 1, 2, 3]), 0, 6);
context3D.setVertexBufferAt(0, vertexBuffer, 0, Context3DVertexBufferFormat.FLOAT_2);
context3D.setVertexBufferAt(1, vertexBuffer, 2, Context3DVertexBufferFormat.FLOAT_2);
}
}
}
from starling-framework.
Related Issues (20)
- TextField AutoScale clips text if multiline and > 100% display scale HOT 2
- Glow Filter: Color issue HOT 7
- native overlay now block touch and mouse input HOT 1
- How do I use it correctly “drawToBitmapData” HOT 6
- AssetManager strange behavior
- AssetManager problem HOT 9
- Reverse delay for Tween HOT 2
- Stats showing actually rendered frames HOT 8
- ArgumentError in createVertexBuffer HOT 14
- DisplayObject dispose() method doesn't automatically remove the object from its parent HOT 3
- Render Texture: "Error #3605: Sampler 0 binds an invalid texture" when not cleared or drawn before actual Image rendering HOT 3
- Render Texture: draw method doesn't render display object with filter if parent is shifted HOT 8
- Texture: Setting vertex UV coordinates doesn't take into account the potential frame of SubTextures HOT 5
- How do we use Asset Manger with Google Play's Install Time Asset Packs? HOT 4
- Object not removed from Stage on Android - Starling maybe? HOT 5
- Starling update from 2.5 to 2.7 doesn't catch tap around the left/bottom side HOT 2
- Juggler: String allocation when using IAnimatable as a Dictionary key HOT 4
- OpenGL error at macOS 12.2.1 (M1) HOT 2
- [Feature Suggestion] Vector Graphic Tesselation HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from starling-framework.