Code: Alles auswählen
ILinfo ImageInfo;
iluGetImageInfo(&ImageInfo);
image->setDataSize(ImageInfo.SizeOfData);
Code: Alles auswählen
// load an image for the texture using DevIL codec
brGraphics::brImageManager& imgMgr = brGraphics::brImageManager::getInstance();
boost::shared_ptr<brGraphics::brImage> image = imgMgr.getImage("data/textures/testTexture.png");
LPDIRECT3DTEXTURE9 texture = 0;
unsigned int size = image->getDataSize();
//try map immage to texture
hr = D3DXCreateTextureFromFileInMemory(d3ddev,
image->getImageData(),
size,
&texture);
if (FAILED(hr))
{
throw brCore::brIllegalStateException(
"Couldn't create valid D3D9Texture!: " + std::string(DXGetErrorString9(hr)));
}
// set texture sampler infos
d3ddev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d3ddev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
Code: Alles auswählen
// load an image for the texture
brGraphics::brImageManager& imgMgr = brGraphics::brImageManager::getInstance();
boost::shared_ptr<brGraphics::brImage> image = imgMgr.getImage("data/textures/testTexture.png");
// create the texture
GLuint texture[1];
glGenTextures(1, &texture[0]);
// Typical Texture Generation Using Data From The Bitmap
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, image->getWidth(), image->getHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, image->getImageData());
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
casten brachten keinen Erfolg ...