Well if the decoder is creating an OpenGL texture resource you can think about creating an extension within the engine that extends Texture2DResource or something like that, but that would probably depend on the decoder code.
The code above is quit straight forward:
Code:
// We need a pointer for the tga image
char* img = 0;
// And a variable for the tga image block size
unsigned int imgsize = 0;
// we create some dummy data for the tga image based on the video buffer configuration
unsigned char* tgaImgData = new unsigned char[videoBufferSize];
// Now we create a tga image for the video image that can be loaded by the engine
Horde3DUtils::createTGAImage(tgaImgData, width, height, depth, &img, &imgsize);
// since we created the buffer only as a dummy we don't need it any longer, the dummy TGA image is now
// stored in the 'img' pointer
delete[] tgaImgData;
// Now add the texture resource within the engine
textureID = Horde3D::addResource(ResourceTypes::Texture2D, textureName, ResourceFlags::NoCompression);
// Load the resource based on the dummy TGA image
Horde3D::loadResource(textureID, (char*) img, imgsize))
// Free the allocated memory for the TGA image, since we don't use it any longer
Horde3DUtils::freeMem(&img);
After the texture resource was created within the engine we can update it using updateTextureResource as mentioned before.
Quote:
I wanted to load objects dynamically, since I do not want to do 729 .XML files
If you don't use 729 different videos you don't have to create 729 XML files.
And you can always check the source code, too, if you don't understand some of my proposals immediately.