Hikari in Form (flash, flex)

alamata

26-12-2010 13:19:35

hey,.

i'm discovering Mogre :D
so
i'm totaly new in mogre,...

my final goal is to have the possibility to display in a form
with inside it some flash or better some flex,...

i have try the mogreform sample,..;

it is ok,... :wink:

but i must make the rendering by OpenGL
else i ve got an error

rem
i work an 7 64 bit
with ogre 1.7.1


i have discovered too hikariwrapper realised by gantz
and at this time i try to display some flash with hikariwrapper in a form

actually,i have added this code on my functionnal mogreform example

HikariManager _HikariManager = new HikariManager("..\\..\\Media\\models");

//creation of a flash control, first we create an overlay, then we load a flash control onto it
FlashControl _FpsControl = _HikariManager.CreateFlashOverlay("Fps", mWindow.GetViewport(0), 230, 230, RelativePosition.Center, 0, 0);
_FpsControl.Load("controls.swf");
_FpsControl.SetTransparent(false);



and,...

i can displaying in the form my mesh and it material ( in the example the ogrehead)
but i cant have other thing that a grey rectangle in place of the hikari flash control

rem i have compiled Hikari_d.dll and put in debug folder

an idea to make my dream real,...

Beauty

26-12-2010 15:06:52

Welcome to Mogre :D

Unfortunately I can't help you with Hikari and Flash, because I never used it.


Related to DirectX:

Did you install the newest updates of DirectX 9? To be shure, call the DX9 web installer/updater again.
http://www.microsoft.com/downloads/en/d ... 6652cd92a3

Did you try to use DirectX with the Mogre basic tutorials?
The tutorial framework contains every library and configuration which is needed.

Is there any helping information in the file ogre.log? (warnings or errors)

alamata

26-12-2010 15:56:06

First ,

i would says thanks for the Welcom... :D

i have followed the information related to directX update... :oops:

Now everything is alrigth...with directX...

and my grey rectangle is became black,... :roll: :lol:

so, thx for your intervention,...


... in the ogre.log...


Compiler error: unknown error in OgreNewt_Example.material(8): token "#ambient" is not recognized
...
WARNING: ogrehead.mesh is an older format ([MeshSerializer_v1.40]); you should upgrade it as soon as possible using the OgreMeshUpgrade tool.
...
Compiler error: unknown error in OgreNewt_Example.material(8): token "#ambient" is not recognized


but no problem with the ogrehead.mesh,....


rem : i have put in the debug directory :

flash.ocx
Hikari.dll
Hikari_d.dll

...

to be continued,...

Beauty

26-12-2010 16:38:01

i have followed the information related to directX update... :oops:

Now everything is alrigth...with directX...

Don't worry. This happened also to me when I tried to run an application on an other computer.
The most important thing: We could solve the problem. :wink:

alamata

26-12-2010 16:56:16


The most important thing: We could solve the problem. :wink:


...right...

hope that "we" could solve mine with Hikari,... :wink: :D

GantZ

27-12-2010 11:54:13

check that you call the Update function of the hikarimanager in a framelistener (or anywhere in the frameloop, it must be called every frame). I just noticed that the wiki article lack this part, it have been updated. Also, the only plugin you need to add in the folder of your exe is the flash.ocx one. you don't need hikari dlls since it's included directly in the wrapper. And finally, check that your flash files (the swf ones) are located in the right folder (..\\..\\Media\\models in your case).

you could also try out Makarui : (viewtopic.php?f=8&t=13630&start=0), it's replace hikariwrapper, although for now, it don't have all the functionalities of hikari.

alamata

27-12-2010 13:17:07

hey GantZ,...

here is the code concerning Hikari that i have modified :


public virtual void CreateFrameListener()
{
mRoot.FrameStarted += new FrameListener.FrameStartedHandler(Main_FrameStarted);
}
bool Main_FrameStarted(FrameEvent evt)
{

HikariManager _HikariManager = new HikariManager("..\\..\\Media\\gui");

//creation of a flash control, first we create an overlay, then we load a flash control onto it
FlashControl _FpsControl = _HikariManager.CreateFlashOverlay("Fps", mWindow.GetViewport(0), 230, 230, RelativePosition.Center, 0, 0);
_FpsControl.Load("hikaritest.swf");
_FpsControl.SetTransparent(false);

_HikariManager.Update();
return true;

}


the result i havent got no more my grey or black rectangle... but i dont see the flash control on replacement of the grey rectangle,...

i work in a form, it s make perhaps a difference,... or there is a camera position problem,...

here is my all little sample code ...

using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Mogre;
using HikariWrapper;
using Awesomium;
using MOIS;


namespace Tutorial
{
public partial class OgreForm : Form
{
Root mRoot;
RenderWindow mWindow;
AwesomiumDotNet.WebView webView;

public OgreForm()
{
InitializeComponent();

this.Size = new Size(800, 600);
Disposed += new EventHandler(OgreForm_Disposed);
Resize += new EventHandler(OgreForm_Resize);
}

void OgreForm_Resize(object sender, EventArgs e)
{
mWindow.WindowMovedOrResized();
}

void OgreForm_Disposed(object sender, EventArgs e)
{
mRoot.Dispose();
mRoot = null;
}

public void Go()
{
Show();
while (mRoot != null && mRoot.RenderOneFrame())
Application.DoEvents();
}

public void Init()
{
// Create root object
mRoot = new Root();

// Define Resources
ConfigFile cf = new ConfigFile();
cf.Load("resources.cfg", "\t:=", true);
ConfigFile.SectionIterator seci = cf.GetSectionIterator();
String secName, typeName, archName;

while (seci.MoveNext())
{
secName = seci.CurrentKey;
ConfigFile.SettingsMultiMap settings = seci.Current;
foreach (KeyValuePair<string, string> pair in settings)
{
typeName = pair.Key;
archName = pair.Value;
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName);
}
}

// Setup RenderSystem
RenderSystem rs = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
// or use "OpenGL Rendering Subsystem" or "Direct3D9 Rendering Subsystem"
mRoot.RenderSystem = rs;
rs.SetConfigOption("Full Screen", "No");
rs.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

// Create Render Window
mRoot.Initialise(false, "Main Ogre Window");
NameValuePairList misc = new NameValuePairList();
misc["externalWindowHandle"] = Handle.ToString();
mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc);

// Init resources
TextureManager.Singleton.DefaultNumMipmaps = 5;
ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

// Create a Simple Scene
SceneManager mgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC);
Camera cam = mgr.CreateCamera("Camera");
cam.AutoAspectRatio = true;
mWindow.AddViewport(cam);
Entity ent = mgr.CreateEntity("ninja", "TV_ED..mesh");
mgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);
mgr.RootSceneNode.Scale(70, 70, 70);

mWindow.GetViewport(0).BackgroundColour = new ColourValue(0.5f,0.25f,0.85f);


mgr.RootSceneNode.Yaw(new Degree(65));


cam.Position = new Mogre.Vector3(0, 100,130);
cam.LookAt(ent.BoundingBox.Center);

}

public virtual void CreateFrameListener()
{
mRoot.FrameStarted += new FrameListener.FrameStartedHandler(Main_FrameStarted);
}
bool Main_FrameStarted(FrameEvent evt)
{

HikariManager _HikariManager = new HikariManager("..\\..\\Media\\gui");

//creation of a flash control, first we create an overlay, then we load a flash control onto it
FlashControl _FpsControl = _HikariManager.CreateFlashOverlay("Fps", mWindow.GetViewport(0), 230, 230, RelativePosition.Center, 0, 0);
_FpsControl.Load("hikaritest.swf");
_FpsControl.SetTransparent(false);

_HikariManager.Update();
return true;

}

}
}


can you make some light on this situation,...

thanks to have modified the wiki page ,... :wink:

GantZ

27-12-2010 13:57:04

move this part in your init() function :

HikariManager _HikariManager = new HikariManager("..\\..\\Media\\gui");

//creation of a flash control, first we create an overlay, then we load a flash control onto it
FlashControl _FpsControl = _HikariManager.CreateFlashOverlay("Fps", mWindow.GetViewport(0), 230, 230, RelativePosition.Center, 0, 0);
_FpsControl.Load("hikaritest.swf");
_FpsControl.SetTransparent(false);


just keep the update() call in Main_FrameStarted(FrameEvent evt).

as a reference, you could be interested by the hikari sample source code :

http://code.google.com/p/mogresdk/sourc ... le.cs?r=79

alamata

27-12-2010 21:11:43

...switched to makarui,...

http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=13630&start=0

rem support flash 10