ResourceGroupManager.InitializeAll AccessViolationEx[SOLVED]

AliAkdurak

16-12-2010 09:19:07

Hello everybody

I just noticed a strange behavior and trying to investigate why it could be?

We kinda developed our own simple mogre framework taking the tutorial framework as an example so in the end it starts with this.


if (Mogre.Root.Singleton == null)
{
_RootRef = new Mogre.Root("Plugins.cfg", "ogre.cfg", "ogre.log");

SetupResourceLocations();

GraphicsRootInitialize();
//***********************************************************************************************************
Mogre.TextureManager.Singleton.DefaultNumMipmaps = 5;
Mogre.ResourceGroupManager.Singleton.InitialiseAllResourceGroups();
//***********************************************************************************************************
}
else
{
_RootRef = Mogre.Root.Singleton;

}

After this starting code we create the renderwindow's as our simulation goes multi window multi form(Usually having 3-4 renderwindows working. with two scenes.

The question is if I put the command Mogre.ResourceGroupManager.Singleton.InitialiseAll into the marked place. it gives a AVE(AccessViolationExp) but if I use it just after I create renderwindows and it works perfectly but gives the result of bad taste in GUI design empty renderwindows wait for our resources to be loaded. But main puzzling thing is I read through the manual and checked API reference and did not saw a thing about resource group manager needing the renderwindows (Not even viewport nor cameras are created at that time.)

It is not actually a problem but I wonder why this happens can anyone point me to right direction to study for understanding this.

By the way this is the log when it gives the exception.

11:00:33: Creating resource group General
11:00:33: Creating resource group Internal
11:00:33: Creating resource group Autodetect
11:00:33: SceneManagerFactory for type 'DefaultSceneManager' registered.
11:00:33: Registering ResourceManager for type Material
11:00:33: Registering ResourceManager for type Mesh
11:00:33: Registering ResourceManager for type Skeleton
11:00:33: MovableObjectFactory for type 'ParticleSystem' registered.
11:00:33: OverlayElementFactory for type Panel registered.
11:00:33: OverlayElementFactory for type BorderPanel registered.
11:00:33: OverlayElementFactory for type TextArea registered.
11:00:33: Registering ResourceManager for type Font
11:00:33: ArchiveFactory for archive type FileSystem registered.
11:00:33: ArchiveFactory for archive type Zip registered.
11:00:33: DDS codec registering
11:00:33: FreeImage version: 3.13.1
11:00:33: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
11:00:33: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,bay,bmq,cr2,crw,cs1,dc2,dcr,dng,erf,fff,hdr,k25,kdc,mdc,mos,mrw,nef,orf,pef,pxn,raf,raw,rdc,sr2,srf,arw,3fr,cine,ia,kc2,mef,nrw,qtk,rw2,sti,drf,dsc,ptx,cap,iiq,rwz
11:00:33: PVRTC codec registering
11:00:33: Registering ResourceManager for type HighLevelGpuProgram
11:00:33: Registering ResourceManager for type Compositor
11:00:33: MovableObjectFactory for type 'Entity' registered.
11:00:33: MovableObjectFactory for type 'Light' registered.
11:00:33: MovableObjectFactory for type 'BillboardSet' registered.
11:00:33: MovableObjectFactory for type 'ManualObject' registered.
11:00:33: MovableObjectFactory for type 'BillboardChain' registered.
11:00:33: MovableObjectFactory for type 'RibbonTrail' registered.
11:00:33: Loading library .\RenderSystem_Direct3D9_d
11:00:33: Installing plugin: D3D9 RenderSystem
11:00:33: D3D9 : Direct3D9 Rendering Subsystem created.
11:00:33: D3D9: Driver Detection Starts
11:00:33: D3D9: Driver Detection Ends
11:00:33: Plugin successfully installed
11:00:33: Loading library .\RenderSystem_GL_d
11:00:33: Installing plugin: GL RenderSystem
11:00:33: OpenGL Rendering Subsystem created.
11:00:35: Plugin successfully installed
11:00:35: Loading library .\Plugin_ParticleFX_d
11:00:35: Installing plugin: ParticleFX
11:00:35: Particle Emitter Type 'Point' registered
11:00:35: Particle Emitter Type 'Box' registered
11:00:35: Particle Emitter Type 'Ellipsoid' registered
11:00:35: Particle Emitter Type 'Cylinder' registered
11:00:35: Particle Emitter Type 'Ring' registered
11:00:35: Particle Emitter Type 'HollowEllipsoid' registered
11:00:35: Particle Affector Type 'LinearForce' registered
11:00:35: Particle Affector Type 'ColourFader' registered
11:00:35: Particle Affector Type 'ColourFader2' registered
11:00:35: Particle Affector Type 'ColourImage' registered
11:00:35: Particle Affector Type 'ColourInterpolator' registered
11:00:35: Particle Affector Type 'Scaler' registered
11:00:35: Particle Affector Type 'Rotator' registered
11:00:35: Particle Affector Type 'DirectionRandomiser' registered
11:00:35: Particle Affector Type 'DeflectorPlane' registered
11:00:35: Plugin successfully installed
11:00:35: Loading library .\Plugin_BSPSceneManager_d
11:00:35: Installing plugin: BSP Scene Manager
11:00:35: Plugin successfully installed
11:00:35: Loading library .\Plugin_CgProgramManager_d
11:00:35: Installing plugin: Cg Program Manager
11:00:35: Plugin successfully installed
11:00:35: Loading library .\Plugin_PCZSceneManager_d.dll
11:00:35: Installing plugin: Portal Connected Zone Scene Manager
11:00:35: PCZone Factory Type 'ZoneType_Default' registered
11:00:35: Plugin successfully installed
11:00:35: Loading library .\Plugin_OctreeZone_d.dll
11:00:35: Installing plugin: Octree Zone Factory
11:00:35: Plugin successfully installed
11:00:35: Loading library .\Plugin_OctreeSceneManager_d
11:00:35: Installing plugin: Octree & Terrain Scene Manager
11:00:35: Plugin successfully installed
11:00:35: *-*-* OGRE Initialising
11:00:35: *-*-* Version 1.7.1 (Cthugha)
11:00:35: Creating resource group Bootstrap
11:00:35: Added resource location 'C:\MogreSDK\Media\packs\OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'
11:00:35: Added resource location 'C:\MogreSDK\Media' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\fonts' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\materials\programs' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\materials\scripts' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\materials\textures' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\models' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\overlays' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\particle' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location '.\Media\Backgrounds\' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location '.\Media\Targets\3D\Meshes' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location '.\Media\Targets\3D\Textures' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location '.\Media\Targets\3D\Materials' of type 'FileSystem' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\packs\cubemap.zip' of type 'Zip' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\packs\cubemapsJS.zip' of type 'Zip' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\packs\dragon.zip' of type 'Zip' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\packs\fresneldemo.zip' of type 'Zip' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\packs\ogretestmap.zip' of type 'Zip' to resource group 'General'
11:00:35: Added resource location 'C:\MogreSDK\Media\packs\skybox.zip' of type 'Zip' to resource group 'General'
11:00:35: D3D9 : RenderSystem Option: Allow NVPerfHUD = No
11:00:35: D3D9 : RenderSystem Option: FSAA = 4
11:00:35: D3D9 : RenderSystem Option: Floating-point mode = Fastest
11:00:35: D3D9 : RenderSystem Option: Full Screen = Yes
11:00:35: D3D9 : RenderSystem Option: Rendering Device = Monitor-1-ATI Mobility Radeon HD 4500/5100 Series
11:00:35: D3D9 : RenderSystem Option: Resource Creation Policy = Create on all devices
11:00:35: D3D9 : RenderSystem Option: VSync = Yes
11:00:35: D3D9 : RenderSystem Option: VSync Interval = 4
11:00:35: D3D9 : RenderSystem Option: Video Mode = 1680 x 945 @ 32-bit colour
11:00:36: D3D9 : RenderSystem Option: sRGB Gamma Conversion = No
11:00:36: CPU Identifier & Features
11:00:36: -------------------------
11:00:36: * CPU ID: GenuineIntel: Intel(R) Core(TM)2 Duo CPU T6400 @ 2.00GHz
11:00:36: * SSE: yes
11:00:36: * SSE2: yes
11:00:36: * SSE3: yes
11:00:36: * MMX: yes
11:00:36: * MMXEXT: yes
11:00:36: * 3DNOW: no
11:00:36: * 3DNOWEXT: no
11:00:36: * CMOV: yes
11:00:36: * TSC: yes
11:00:36: * FPU: yes
11:00:36: * PRO: yes
11:00:36: * HT: no
11:00:36: -------------------------
11:00:36: D3D9 : Subsystem Initialising
11:00:36: Registering ResourceManager for type Texture
11:00:36: Registering ResourceManager for type GpuProgram
11:00:36: ***************************************
11:00:36: *** D3D9 : Subsystem Initialised OK ***
11:00:36: ***************************************
11:00:36: Parsing scripts for resource group Autodetect
11:00:36: Finished parsing scripts for resource group Autodetect
11:00:36: Parsing scripts for resource group Bootstrap
11:00:36: Parsing script OgreCore.material
11:00:36: Parsing script OgreProfiler.material
11:00:36: Parsing script Ogre.fontdef
11:00:36: Parsing script OgreDebugPanel.overlay
BAMM! AVE in output window of VS Of course id does not show up in ogre log


It Look like this in the output window
***************************************
Parsing scripts for resource group Autodetect
Finished parsing scripts for resource group Autodetect
Parsing scripts for resource group Bootstrap
Parsing script OgreCore.material
ParsFirst-chance exception at 0x0a4bff71 in AES3DCore.exe: 0xC0000005: Access violation reading location 0x0000001e.
A first chance exception of type 'System.AccessViolationException' occurred in Mogre.dll
ing script OgreProfiler.material
Parsing script Ogre.fontdef
Parsing script OgreDebugPanel.overlay
An unhandled exception of type 'System.AccessViolationException' occurred in Mogre.dll

smiley80

16-12-2010 10:01:42

IIRC, that's because Ogre queries the RenderSystem while parsing textures. But without a RenderWindow the RenderSystem hasn't been initialized --boom-> AVE.

it works perfectly but gives the result of bad taste in GUI design empty renderwindows wait for our resources to be loaded
To avoid that, you can do something like initializing a small bootstrap group first so you can show a loading screen.

Beauty

17-12-2010 19:26:05

without a RenderWindow the RenderSystem hasn't been initialized
Interesting fact, that I can't initialise the the whole resource system when I don't have a render window.
Good to know, because I thought about to fork my main application (sonar simulation) to work without any render render window.

AliAkdurak

20-12-2010 09:18:56

Yeah we thought something like that too as our simulation is designed to be extended to be a CAVE simulation but currently works with 3 screens also in result reporting we use mogre too so I thought I should be able create the root and start the engine without the render target but it seems we will just go around it like smiley said. No problem actually just a simple redesign will be enough for us.