OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: Render entitys to rttTex
View page
Source of version: 4
(current)
on RPG game, we always can see the equipWindow has a real-render Model, now we have a way to impl it. {CODE(wrap="1", colors="c++")}const unsigned int SHOW_ENTITY_ON_MAIN_VIEWPORT_FLAG = 1; const unsigned int SHOW_ENTITY_ON_OTHER_VIEWPORT_FLAG = 1 << 1; //or 1 << n const unsigned int SHOW_ENTITY_ON_ALL_VIEWPORT_FLAG = 0xFFFFFFFF; void createCameraLook(const std::string& CameraName, const std::string& TextureName, unsigned int mask = 1 << 1, const Ogre::Vector3& CameraPos = Ogre::Vectir3(0,1,3), const Ogre::Vector3& lookPos = Ogre::Vector3(0,1,0)) { //create a camera look this scenenode(attached entitys) Ogre::Camera* pCameraLookMe = pOgreSceneMgr->createCamera(CameraName); pCameraLookMe->setPosition(CameraPos); pCameraLookMe->lookAt(lookPos); pCameraLookMe->setAutoTracking(true, m_pSceneNode, lookPos); pCameraLookMe->setFarClipDistance(0); pCameraLookMe->setNearClipDistance(1.0); pCameraLookMe->setAutoAspectRatio(true); pSceneNode->attachObject(m_pCameraLookMe); //let's create a rttTex and take the camera Ogre::TexturePtr pRttCameraLookMe = Ogre::TextureManager::getSingleton().createManual( TextureName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, 128, 128, 0, Ogre::PF_DXT5, Ogre::TU_RENDERTARGET ); Ogre::RenderTarget *rttTex = pRttCameraLookMe->getBuffer()->getRenderTarget(); Ogre::Viewport* pVp = rttTex->addViewport(pCameraLookMe); //alpha background pVp->setBackgroundColour(Ogre::ColourValue(0,0,0,0)); //i just set the mainRenderWnd's viewport's visibilitymask to 1, //so this viewport need to set 1 << 1, if you add more the mask must 1 << n pVp->setVisibilityMask(mask); //this viewport don't need sky,shadow,overlay pVp->setOverlaysEnabled(false); pVp->setSkiesEnabled(false); pVp->setShadowsEnabled(false); //every frame render,or not rttTex->setAutoUpdated(true); } //after, you can set the entity's visibilityFlag as you need it to show on which viewport. pEntity->setVisibilityFlags(SHOW_ENTITY_ON_MAIN_VIEWPORT_FLAG | (1 << 1)); {CODE} {CODE(wrap="1", colors="c++")} {CODE} now you can take the rttTex to render to everywhere as you like.
Search by Tags
Search Wiki by Freetags
Latest Changes
IDE Eclipse
FMOD SoundManager
HDRlib
Building Ogre V2 with CMake
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
...more
Search
Find
Advanced
Search Help
Online Users
103 online users