Can Custom Cplusplus CHOP access TOP pixel information?

I want to process RGB data in Custom CHOP by referring to TOP like TOP to CHOP.
Can Custom CHOP access TOP pixel information?

I read the documentation, but it didn’t say anything about it.

Thank you.

Yes, the same code you see in the CPUMemoryTOP example can be used in CHOP to download the texture from the referenced TOP.

Thanks, Malcolm.

I was able to load TOP into Custom Parameter of CPlusPlus CHOP.
How do I then access the TOP RGB data?

void setupParameters(OP_ParameterManager* manager, void* reserved1) override
	// load TOP
		OP_StringParameter sp; = "Inputtop";
		sp.label = "Input TOP"; = "Input";
		OP_ParAppendResult res = manager->appendTOP(sp);
		if (res != OP_ParAppendResult::Success) {
			// some error handling


const OP_TOPInput* top = inputs->getInputTOP(0);
When I tried to get top using this as described in the CPUMemoryTOP example, I got an error that getInputTOP() can only be used with TOP.

(the second error was resolved)

I’m a C++ super newbie, so I may be writing it wrong.

Since it’s a parameter, you need to use getParTOP(), instead of of getInputTOP(). getInputTOP is only for TOPs, since they have TOPs as their input connectors


I was able to create a C Plus Plus CHOP that outputs the input TOP RGB data to each channel.
But I didn’t use getParTOP, so I have an additional question.

I wrote the following code based on the CPUMemoryTOP example.

Please tell me how to write this part using getParTOP

void execute(CHOP_Output* output, const OP_Inputs* inputs, void* reserved1) override
		const OP_TOPInput* topInput = inputs->getTOP(inputs->getParString("Inputtop"));
		if (topInput)
			OP_TOPInputDownloadOptions opts;  // use default options
			OP_SmartRef<OP_TOPDownloadResult> downloadTex = topInput->downloadTexture(opts, nullptr);

			if (downloadTex)
				const uint8_t* pixelData = reinterpret_cast<const uint8_t*>(downloadTex->getData());
				int width = downloadTex->textureDesc.width;
				int height = downloadTex->textureDesc.height;

				for (int y = 0; y < height; y++)
					for (int x = 0; x < width; x++)
						// calculate pixel data index (assume 1 pixel for every 4 bytes)
						int pixelIdx = (y * width + x) * 4;

						// set output
						output->channels[0][y * width + x] = pixelData[pixelIdx] / 255.0f;     // R
						output->channels[1][y * width + x] = pixelData[pixelIdx + 1] / 255.0f; // G
						output->channels[2][y * width + x] = pixelData[pixelIdx + 2] / 255.0f; // B

You would create a TOP parameter using appendTOP() when creating your custom parameters. That way you can use getParTOP() on the parameter itself.