Flash with Away3D library not working

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
Post Reply
onoxo
Met Resolume in a bar the other day
Posts: 2
Joined: Mon Jul 22, 2013 23:18

Flash with Away3D library not working

Post by onoxo »

Hi!
I have a swf that compiles without errors and works fine when I open it with flash player or test it in Flash IDE, but throws me this error when I play it in Resolume:
Error #2044: Unhandled ErrorEvent:. text=Error #3702: Context3D not available.

I'm using Away3D library and that's the reason for using Context3D.

Thanks!
Vedran

dirtyjohn_lv
Is seriously in love with Resolume. Met the parents and everything
Posts: 388
Joined: Sat Oct 29, 2011 22:24
Location: Las Vegas, NV

Re: Flash with Away3D library not working

Post by dirtyjohn_lv »

I'm having the same issue.

That error comes from having to tell the SWF container how to render Stage3D (for some reason, HTML or MXML for AIR has to be set to renderMode=direct)

I've forced the my SWF to render direct using

Code: Select all

-use-direct-blit=true
but Resolume still won't render the cube.

I've even gone as far as to add

Code: Select all

<use-direct-blit>true</use-direct-blit>
to the flex-config.xml file and still no luck rendering in Resolume.

My question is, how does Resolume render SWF files, does it take them as is or does it use the renderMode at all?

My code is below, you need the Flex SDK and Away3D framework to render (I use the gaming SDK from Adobe).

Code: Select all

package 
{
	// import Away3D classes to make a cube
	import away3d.entities.Mesh;
	import away3d.containers.View3D;
	import away3d.lights.DirectionalLight;
	import away3d.materials.ColorMaterial;
	import away3d.primitives.CubeGeometry;
	import away3d.primitives.WireframeCube;

	import flash.display.Sprite;
	import flash.events.Event;

	// configure flash container
	[SWF(frameRate = "60", backgroundColor = "0x000000", width = "800", height = "600", quality = "LOW", pageTitle = "boxTest45")]

	public class Main extends Sprite
	{
		// variables for creating the 3D scene and cube
		private var _view:View3D;
		private var _color:ColorMaterial;
		private var _cube:Mesh;


		public function Main()
		{
			// setup a view for the 3D space
			_view = new View3D();
			addChild(_view);

			// build scene
			initScene();
		}

		private function initScene():void
		{
			initMaterials();
			init3DObjects();

			stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
		}

		private function initMaterials():void
		{

			// setup a color material
			_color = new ColorMaterial(0xff0000,0.5);

			// more materials
		}

		private function init3DObjects():void
		{

			// wireframe cube for testing, pass to _view.scene.addChild instead of _cube
			var _wireCube:WireframeCube = new WireframeCube(300,300,50,0xff0000,1);

			// make the cube
			_cube = new Mesh(new CubeGeometry(300,300,50,3,3,3),_color);

			// add the cube to the viewport
			_view.scene.addChild(_cube);
		}

		private function enterFrameHandler(e:Event):void
		{

			// rotate the cube so we konw it's 3D
			_cube.rotationX +=  1.5;
			_cube.rotationY +=  1.5;

			_view.render();
		}

	}

}

onoxo
Met Resolume in a bar the other day
Posts: 2
Joined: Mon Jul 22, 2013 23:18

Re: Flash with Away3D library not working

Post by onoxo »

I have updated to the latest flash player and now I can't even play the swf files that came with resolume distribution :/

Would be great to know witch fp version is supported in resoulme.

dirtyjohn_lv
Is seriously in love with Resolume. Met the parents and everything
Posts: 388
Joined: Sat Oct 29, 2011 22:24
Location: Las Vegas, NV

Re: Flash with Away3D library not working

Post by dirtyjohn_lv »

I updated to the latest player version and everything still works in Resolume as it should.

Since Res seems use empty.swf as a container to load other SWF files in (?) I made a new one with updated preferences (player version 11.4, AS3, hardware acceleration = direct) and still get the same errors in Resolume.

dirtyjohn_lv
Is seriously in love with Resolume. Met the parents and everything
Posts: 388
Joined: Sat Oct 29, 2011 22:24
Location: Las Vegas, NV

Re: Flash with Away3D library not working

Post by dirtyjohn_lv »

It's not just Away3D, it's the general functionality of flash.display.Context3D

Trying to force the SWF to render on the GPU in the Flex compiler with -use-direct-blit or -use-gpu works ok in the standalone flash palyer/debugger and even in Chrome (because Chrome has its own support built in, even renders on GPU itself when needed).

Resolume uses the ActiveX control on Windows %WINDIR%\system32\Macromed\Flash\ (32bit because Resolume is 32bit)
The ActiveX control requires object parameters to be sent for the container (which would be HTML parameters like loop, menu, qualty, WMODE). Wmode, which controls how it renders.

For now you have to use Interop.ShockwaveFlashObject.dll and build your own C or C# library to call Actionscript classes at runtime to send the object parameters to the ActiveX control.

I am trying to do this, but barely have the time and not very good with C

Post Reply