Search - User list
Full Version: Getting image from COP HDA Subnet [Solved]
Root » Houdini Engine API » Getting image from COP HDA Subnet [Solved]
sburrichter
EDIT: This has been solved! Grab Houdini 16.5.525 or higher to be able to use this.

Hey guys! I'm doing a little experiment and need a sanity check. Haven't been able to find a whole lot of information, so I'm wondering if anyone's here looked at this.

So, I have a COP Subnet HDA that's simply loading an image. However, when I try to extract it to memory and write it out to a file or have Qt load it, it looks completely washed out. Does this code look like the right method for a simple image extraction through COPs?

HAPI_CookNode( this->session, this->assetNode, &this->cookOptions);
HAPI_RenderCOPToImage(this->session, this->assetNode);

int bufferSize;
HAPI_ExtractImageToMemory(this->session, this->assetNode, HAPI_PNG_FORMAT_NAME, "C A", &bufferSize);

std::vector<char> data;
data.resize(bufferSize);
HAPI_GetImageMemoryBuffer(this->session, this->assetNode, &data.front(), bufferSize);

Regarding writing out, I'm just using ofstream:

std::ofstream file(outputFilePath);
if( file )
{
    file.write(&data.front(), data.size());
}

Notes: I attached a sample of the output. I also haven't looked through the data of the image itself to see what is exactly missing.
seelan
Could you try with Houdini 16.5.525 or newer? We might have fixed this recently.
sburrichter
Looks like that did the trick! Thanks guys! Attached a screenshot of the result with Qt reading the memory output. Image discrepancy is due to some leftover settings that I'm too lazy to change
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB