- Timestamp:
- 04/19/06 00:27:14 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IMGTexture.cpp
r745 r751 29 29 // delete mMaterial; 30 30 //} 31 } 32 33 void 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; 31 60 } 32 61 … … 191 220 } 192 221 193 void Texture::create(Ogre::String fileName, unsigned int width, unsigned int height, Ogre::PixelFormat pixelFormat, Ogre::Camera *camera )222 void Texture::create(Ogre::String fileName, unsigned int width, unsigned int height, Ogre::PixelFormat pixelFormat, Ogre::Camera *camera, Ogre::ColourValue backgroundColour) 194 223 { 195 224 mCamera = camera; … … 203 232 Ogre::Viewport *v = rt->addViewport(mCamera); 204 233 v->setClearEveryFrame(true); 205 v->setBackgroundColour( Ogre::ColourValue(1.0f, 1.0f, 1.0f, 0.0f));234 v->setBackgroundColour(backgroundColour); 206 235 v->setOverlaysEnabled(false); 207 236 v->setDimensions(0,0,1.0,1.0);
Note: See TracChangeset
for help on using the changeset viewer.