源代码如下:
Ogre::Root* root=new Ogre::Root("plugins.cfg","ogre.cfg","ogre.log");
bool rtn=root->showConfigDialog();
Ogre::RenderWindow* window=root->initialise(true,"Render window");
//创建场景管理器
Ogre::SceneManager *mSceneMgr=root->createSceneManager(Ogre::ST_GENERIC);//(Ogre::ST_GENERIC, "ExampleSMInstance");
mSceneMgr->setAmbientLight(ColourValue(1,1,1));
Ogre::Light * l=mSceneMgr->createLight("light");
l->setPosition(10,10,15);
Ogre::Camera *cam=mSceneMgr->createCamera("Camera");
cam->setPosition(Ogre::Vector3(0,0,0));
cam->lookAt(0,0,10);
cam->setNearClipDistance(5);
// //创建帧监听器
ExampleFrameListener* listener=new ExampleFrameListener(window,cam);
//显示左下角帧率提示信息
listener->showDebugOverlay(true);
//将监听器加到根节点上
root->addFrameListener(listener);
root->startRendering();
}
——————————————————————————————————
配置文件如下:
# Resources required by the sample browser and most samples.
[Essential]
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/SdkTrays.zip
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/thumbnails
# Common sample resources needed by many of the samples.
# Rarely used resources should be separately loaded by the
# samples which require them.
[Popular]
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/fonts
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/materials/programs
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/materials/scripts
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/materials/textures
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/materials/textures/nvidia
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/models
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/particle
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/DeferredShadingMedia
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/PCZAppMedia
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/RTShaderLib
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media/RTShaderLib/materials
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/cubemap.zip
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/cubemapsJS.zip
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/dragon.zip
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/fresneldemo.zip
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/ogretestmap.zip
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/ogredance.zip
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/Sinbad.zip
Zip=F:/ogre/ogre_src_v1-7-1/Samples/Media/packs/skybox.zip
[General]
FileSystem=F:/ogre/ogre_src_v1-7-1/Samples/Media
----------------------------------------------------------
日志文件如下:
14:47:11: Creating resource group General
14:47:11: Creating resource group Internal
。。。。
14:47:11: DDS codec registering
14:47:11: FreeImage version: 3.13.1
14:47:11: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
14:47:11: 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
14:47:11: Registering ResourceManager for type HighLevelGpuProgram
14:47:11: Registering ResourceManager for type Compositor
14:47:11: MovableObjectFactory for type 'Entity' registered.
14:47:11: MovableObjectFactory for type 'Light' registered.
14:47:11: MovableObjectFactory for type 'BillboardSet' registered.
14:47:11: MovableObjectFactory for type 'ManualObject' registered.
。。。。。
14:47:11: Plugin successfully installed
14:47:11: *-*-* OGRE Initialising
14:47:11: *-*-* Version 1.7.1 (Cthugha)
14:47:12: CPU Identifier & Features
14:47:12: -------------------------
14:47:12: * CPU ID: GenuineIntel: Pentium(R) Dual-Core CPU E5400 @ 2.70GHz
14:47:12: * SSE: yes
14:47:12: * SSE2: yes
14:47:12: * SSE3: yes
14:47:12: * MMX: yes
14:47:12: * MMXEXT: yes
14:47:12: * 3DNOW: no
14:47:12: * 3DNOWEXT: no
14:47:12: * CMOV: yes
14:47:12: * TSC: yes
14:47:12: * FPU: yes
14:47:12: * PRO: yes
14:47:12: * HT: no
14:47:12: -------------------------
14:47:12: *** Starting Win32GL Subsystem ***
14:47:12: GLRenderSystem::_createRenderWindow "Render window", 1024x768 windowed miscParams: FSAA=0 FSAAHint= colourDepth=32 displayFrequency=0 gamma=false vsync=false vsyncInterval=1
14:47:12: Created Win32Window 'Render window' : 1032x802, 32bpp
14:47:12: GL_VERSION = 2.0.0 - Build 6.14.10.5039
14:47:12: GL_VENDOR = Intel
14:47:12: GL_RENDERER = Intel Eaglelake
14:47:12: GL_EXTENSIONS = GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_blend_color GL_EXT_abgr
。。。。
14:47:12: Supported WGL extensions: WGL_ARB_buffer_region WGL_ARB_extensions_string WGL_ARB_make_current_read WGL_ARB_pixel_format WGL_ARB_pbuffer WGL_EXT_extensions_string WGL_EXT_swap_control
14:47:12: ***************************
14:47:12: *** GL Renderer Started ***
14:47:12: ***************************
14:47:12: Registering ResourceManager for type GpuProgram
14:47:12: GLSL support detected
14:47:12: GL: Using GL_EXT_framebuffer_object for rendering to textures (best)
14:47:12: FBO PF_UNKNOWN depth/stencil support: D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0
14:47:12: FBO PF_R8G8B8 depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_B8G8R8 depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_A8R8G8B8 depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_B8G8R8A8 depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_FLOAT16_RGB depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_FLOAT16_RGBA depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_FLOAT32_RGB depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_FLOAT32_RGBA depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_X8R8G8B8 depth/stencil support: D0S0 D0S1
14:47:12: FBO PF_X8B8G8R8 depth/stencil support: D0S0 D0S1
14:47:12: [GL] : Valid FBO targets PF_UNKNOWN PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_B8G8R8A8 PF_FLOAT16_RGB PF_FLOAT16_RGBA PF_FLOAT32_RGB PF_FLOAT32_RGBA PF_X8R8G8B8 PF_X8B8G8R8
14:47:12: RenderSystem capabilities
14:47:12: -------------------------
14:47:12: RenderSystem Name: OpenGL Rendering Subsystem
14:47:12: GPU Vendor: intel
14:47:12: Device Name: Intel Eaglelake
14:47:12: Driver Version: 2.0.0.0
。。。。
14:47:12: PCZone Factory Type 'ZoneType_Octree' registered
14:47:12: PCZone Factory Type 'ZoneType_Terrain' registered
14:47:12: SceneManagerFactory for type 'OctreeSceneManager' registered.
14:47:12: SceneManagerFactory for type 'TerrainSceneManager' registered.
14:47:12: *** Initializing OIS ***
14:47:12: OGRE EXCEPTION(5:ItemIdentityException): OverlayElement with name Core/AverageFps not found. in OverlayManager::getOverlayElementImpl at ..\..\ogre\ogre_src_v1-7-1\OgreMain\src\OgreOverlayManager.cpp (line 635)
14:47:12: OGRE EXCEPTION(5:ItemIdentityException): OverlayElement with name Core/AverageFps not found. in OverlayManager::getOverlayElementImpl at ..\..\ogre\ogre_src_v1-7-1\OgreMain\src\OgreOverlayManager.cpp (line 635)
。。。。。
2 个解决方案
#1
问题不在你的代码里!而是你代码的位置放得不对!
#2
问题已经解决,不过还是谢谢你^_^
原因是没有载入资源文件。。。
原因是没有载入资源文件。。。
#1
问题不在你的代码里!而是你代码的位置放得不对!
#2
问题已经解决,不过还是谢谢你^_^
原因是没有载入资源文件。。。
原因是没有载入资源文件。。。