Ignore:
Timestamp:
04/19/06 00:27:14 (18 years ago)
Author:
igarcia
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGTexture.cpp

    r745 r751  
    2929        //      delete mMaterial; 
    3030        //} 
     31} 
     32 
     33void Texture::debug() 
     34{ 
     35        unsigned char* pBufferBox = new unsigned char[mTexture->getBuffer(0, 0)->getSizeInBytes()]; 
     36 
     37    // Read pixels       
     38        Ogre::PixelBox pBox(mWidth, mHeight, 1, mPixelFormat, pBufferBox); 
     39 
     40        mTexture->getBuffer(0, 0)->blitToMemory(pBox); 
     41 
     42        if (mPixelFormat == Ogre::PF_FLOAT32_RGBA) 
     43        { 
     44                imdebug("rgba w=%d h=%d %p b=32f",pBox.getWidth(), pBox.getHeight(), pBox.data); 
     45        } 
     46 
     47        if (mPixelFormat == Ogre::PF_A8R8G8B8) 
     48        { 
     49                //unsigned char* pBufferDest = new unsigned char[pBox.getWidth()*pBox.getHeight()*4];    
     50                unsigned char* pBufferDest = new unsigned char[pBox.getWidth()*pBox.getHeight()*4];      
     51                Ogre::PixelBox pDest(mWidth, mHeight, 1, Ogre::PF_BYTE_RGBA, pBufferDest); 
     52                Ogre::PixelUtil::bulkPixelConversion(pBox.data, mPixelFormat, pDest.data, Ogre::PF_BYTE_RGBA, pBox.getWidth()*pBox.getHeight()); 
     53                 
     54                imdebug("rgba w=%d h=%d %p ", pDest.getWidth(), pDest.getHeight(), pDest.data); 
     55                 
     56                delete [] pBufferDest; 
     57        } 
     58 
     59        delete [] pBufferBox; 
    3160} 
    3261 
     
    191220} 
    192221 
    193 void Texture::create(Ogre::String fileName, unsigned int width, unsigned int height, Ogre::PixelFormat pixelFormat, Ogre::Camera *camera) 
     222void Texture::create(Ogre::String fileName, unsigned int width, unsigned int height, Ogre::PixelFormat pixelFormat, Ogre::Camera *camera, Ogre::ColourValue backgroundColour) 
    194223{ 
    195224        mCamera = camera; 
     
    203232        Ogre::Viewport *v = rt->addViewport(mCamera); 
    204233        v->setClearEveryFrame(true); 
    205         v->setBackgroundColour(Ogre::ColourValue(1.0f, 1.0f, 1.0f, 0.0f)); 
     234        v->setBackgroundColour(backgroundColour); 
    206235        v->setOverlaysEnabled(false); 
    207236        v->setDimensions(0,0,1.0,1.0);   
Note: See TracChangeset for help on using the changeset viewer.