@paroj, bad news. After thousands of tests, the new function is not working perfectly. I'm encountering random errors when experimenting in the scene. Sometimes, when I try to create an entity for the first time, I get an Access Memory Violation error. If it’s not the entity, the error occurs in another part of the code, but it’s always the same Access Violation error.
After adding logs throughout the Ogre source code, I tracked it down to this specific line:
Code: Select all
hr = pUnk->QueryInterface(__uuidof(IDXGIResource), (void**)&pDXGIResource);
As I mentioned, sometimes the crash happens at the very beginning, and I don't even get the chance to see the ogrehead on the screen. Another issue occurs when I try to activate the bounding box for an entity—again, an Access Violation error.
I’ve implemented some methods to move the entity and the camera using WPF, and those work just fine without crashes. However, if I attempt to activate the bounding box, it immediately crashes with an Access Violation error.
If it helps, here is my code for creating the Texture and the Scene:
Code: Select all
public void CreateTexture11(IntPtr surface)
{
texturePtr = TextureManager.getSingleton().create("Ogre Render", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
texturePtr.setUsage(0x20);
texturePtr._setSurface(surface);
texturePtr.load();
}
Code: Select all
private void OgreHeadScene()
{
#region Ambient Light
scnMgr.setAmbientLight(new ColourValue(0.1f, 0.1f, 0.1f));
#endregion
#region Camera
camNode = scnMgr.getRootSceneNode().createChildSceneNode();
cam = scnMgr.createCamera("myCam");
cam.setNearClipDistance(5);
cam.setAutoAspectRatio(true);
camNode.setPosition(0, 47, 222);
camNode.attachObject(cam);
#endregion
#region Light
Light mainLight = scnMgr.createLight("MainLight");
SceneNode lightNode = scnMgr.getRootSceneNode().createChildSceneNode();
lightNode.setPosition(20, 80, 50);
lightNode.attachObject(mainLight);
#endregion
#region Entity
Entity entity = scnMgr.createEntity("OgreHead", "ogrehead.mesh");
SceneNode entityNode = scnMgr.getRootSceneNode().createChildSceneNode();
entityNode.attachObject(entity);
Entity entity2 = scnMgr.createEntity("OgreHead2", "ogrehead.mesh");
SceneNode entityNode2 = scnMgr.getRootSceneNode().createChildSceneNode(new Vector3(84, 48, 0));
entityNode2.attachObject(entity2);
Entity entity3 = scnMgr.createEntity("OgreHead3", "ogrehead.mesh");
SceneNode entityNode3 = scnMgr.getRootSceneNode().createChildSceneNode(new Vector3(0, 104, 0));
entityNode3.setScale(2, 1.2f, 2);
entityNode3.attachObject(entity3);
Entity entity4 = scnMgr.createEntity("OgreHead4", "ogrehead.mesh");
SceneNode entityNode4 = scnMgr.getRootSceneNode().createChildSceneNode(new Vector3(-84, 48, 0));
entityNode4.roll(new Radian(new Degree(-90).valueRadians()));
entityNode4.attachObject(entity4);
#endregion
}