I'm doing 2D texture mapping.
In some cases, i read the image from a file using and the following code
snippet works fine:
// read image from file
vtkBMPReader* m_bmpReader = vtkBMPReader::New();
// get vtkImageData from image
vtkImageData* m_TextureImage = vtkImageData::New();
m_TextureImage = m_bmpReader->GetOutput();
// then set vtkImageData to vtkTexture
vtkTexture* m_Texture = vtkTexture::New();
In some other cases, the image that i need to use as a texture is not
read from a file, but is directly a pixel array.
Obviously, i could write this pixel array to a bitmap file, and then
read it back from vtk using the above code, but i would much prefer to
avoid that for performance reasons.
What i really want is to put this pixel array into a vtkImageData
object, but so far i didn't succeed.