I want the texture like the fellowing 2D texture:
|-----|------|
|Red|Blue |
|-------------|
|Green|White |
|----------------|
how can i create it?
My code is here,but the pixel color is not correct. Why?
Code: Select all
Ogre::TexturePtr tPtr=TextureManager::getSingleton().createManual("EdgeTable",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
TEX_TYPE_2D,2,2,0,PF_R8G8B8A8 );
HardwarePixelBufferSharedPtr pixelBuffer=tPtr->getBuffer();
pixelBuffer->lock(HardwareBuffer::HBL_NORMAL);
const PixelBox& pixelBox = pixelBuffer->getCurrentLock();
uint8* pDest = static_cast<uint8*>(pixelBox.data);
*pDest++=255; //R
*pDest++=0; //G
*pDest++=0; //B
*pDest++=255; //A
*pDest++=0; //R
*pDest++=255; //G
*pDest++=0; //B
*pDest++=255; //A
*pDest++=0; //R
*pDest++=0; //G
*pDest++=255 //B
*pDest++=0; //A
*pDest++=255; //R
*pDest++=255; //G
*pDest++=255; //B
*pDest++=255; //A
pixelBuffer->unlock();