Commits

Hesham Wahba committed b449d74

Fixup part of Ogre3D plugin to work with Ogre 1.9

Comments (0)

Files changed (2)

IbexMac/ogre3d_plugin/TutorialApplication.cpp

       http://www.ogre3d.org/tikiwiki/
 -----------------------------------------------------------------------------
 */
-#define OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR 0
+//#define OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR 0
 
 #include "TutorialApplication.h"
 
 {
 }
 
+void Ogre3DRendererPlugin::init() {
+    go();
+    //      mCamera->lookAt(-100, 0, 0);
+}
+
 void Ogre3DRendererPlugin::setDesktopTexture(unsigned int desktopTexture_) {
   this->desktopTexture = desktopTexture_;
   if(mRenderSystemCommandsRenderQueueListener) {
         MIP_DEFAULT,//0,                // number of mipmaps
         Ogre::PF_BYTE_RGBA,     // pixel format
         Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE,
-        0);//TU_DEFAULT);
+        0).staticCast<GLTexture>();//TU_DEFAULT);
 
   t->_fireLoadingComplete(true);
   std::cerr << "**** DESKTOP TEXTURE: " << this->desktopTexture << std::endl;
 // Create a material using the texture
  /*Ogre::MaterialPtr */material = Ogre::MaterialManager::getSingleton().create(
      "DynamicTextureMaterial", // name
-     Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+                                                                               Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);//.staticCast<Material>();;
 
  material->getTechnique(0)->getPass(0)->createTextureUnitState("DynamicTexture");
  material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_REPLACE);//SBT_TRANSPARENT_ALPHA);
 //  ogreHead->setMaterial(material);
 
  Ogre::ManualObject* manual = mSceneMgr->createManualObject("manual");
-//  manual->begin("DynamicTextureMaterial", Ogre::RenderOperation::OT_TRIANGLE_STRIP, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+ //manual->begin("DynamicTextureMaterial", Ogre::RenderOperation::OT_TRIANGLE_STRIP, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
  manual->begin("BlankWhiteMaterial", Ogre::RenderOperation::OT_TRIANGLE_STRIP, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
 
  manual->textureCoord(0, 0);
 }
 
 void Ogre3DRendererPlugin::setupRTT() {
+    std::cerr << "setupRTT... start" << std::endl;
   if(!SBS) return;
+    
+    std::cerr << "setupRTT... sbs " << mWindow->getWidth() << "x" << mWindow->getHeight() << std::endl;
 
   rtt_texture = Ogre::TextureManager::getSingleton().createManual("RttTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, mWindow->getWidth(), mWindow->getHeight(), 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET);
+    std::cerr << "setupRTT... loaded material RttTex" << std::endl;
   renderTexture = rtt_texture->getBuffer()->getRenderTarget();
+    std::cerr << "setupRTT... getRenderTarget()" << std::endl;
 
   renderTexture->addViewport(mCamera2);
   renderTexture->getViewport(0)->setClearEveryFrame(true);
 
   Ogre::SceneNode* miniScreenNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("MiniScreenNode");
   miniScreenNode->attachObject(mMiniScreen);
-  Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName("BarrelDistort");
+    Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName("BarrelDistort");//.staticCast<Material>();;
   material->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("RttTex");
   mMiniScreen->setMaterial("BarrelDistort");
     
   mMiniScreen2->setBoundingBox(Ogre::AxisAlignedBox(-100000.0f * Ogre::Vector3::UNIT_SCALE, 100000.0f * Ogre::Vector3::UNIT_SCALE));
   Ogre::SceneNode* miniScreenNode2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("MiniScreenNode2");
   miniScreenNode2->attachObject(mMiniScreen2);
-  Ogre::MaterialPtr material2 = Ogre::MaterialManager::getSingleton().getByName("BarrelDistort");
+    Ogre::MaterialPtr material2 = Ogre::MaterialManager::getSingleton().getByName("BarrelDistort");//.staticCast<Material>();;
   material2->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("RttTex2");
   mMiniScreen2->setMaterial("BarrelDistort");
+    
+    std::cerr << "setupRTT... done" << std::endl;
 }
 
 void Ogre3DRendererPlugin::createScene()

IbexMac/ogre3d_plugin/TutorialApplication.h

       http://www.ogre3d.org/tikiwiki/
 -----------------------------------------------------------------------------
 */
-#define OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR 0
+//#define OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR 0
 
 #ifndef __TutorialApplication_h_
 #define __TutorialApplication_h_
 #include "BaseApplication.h"
 #include "NativeRenderSystemCommands.h"
 
+#include "../ibex.h"
 #include "../RendererPlugin.h"
 
 #include <Terrain/OgreTerrain.h>
     Ogre3DRendererPlugin(Display *dpy, unsigned long screen, Window window, XVisualInfo *visualinfo, unsigned long context);
     virtual ~Ogre3DRendererPlugin();
 
-    void init() {
-      go();
-//      mCamera->lookAt(-100, 0, 0);
-    }
+    virtual void init();
+    
     void setDesktopTexture(GLuint desktopTexture_);
 
     Window getWindowID() {
       return this->windowId;
     }
-    void render(double timeDiff_);
+    virtual void render(double timeDiff_);
     void step(const Desktop3DLocation &loc_, double timeDiff_) {
       Ogre::FrameEvent f;
       f.timeSinceLastEvent = timeDiff_;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.