MCPcopy Create free account
hub / github.com/MrKepzie/Natron / convertOpenGLTextureToCachedRAMImage

Method convertOpenGLTextureToCachedRAMImage

Engine/EffectInstance.cpp:1518–1543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1516}
1517
1518ImagePtr
1519EffectInstance::convertOpenGLTextureToCachedRAMImage(const ImagePtr& image)
1520{
1521 assert(image->getStorageMode() == eStorageModeGLTex);
1522
1523 boost::shared_ptr<ImageParams> params( new ImageParams( *image->getParams() ) );
1524 CacheEntryStorageInfo& info = params->getStorageInfo();
1525 info.mode = eStorageModeRAM;
1526
1527 ImagePtr ramImage;
1528 getOrCreateFromCacheInternal(image->getKey(), params, true /*useCache*/, &ramImage);
1529 if (!ramImage) {
1530 return ramImage;
1531 }
1532
1533 OSGLContextPtr context = getThreadLocalOpenGLContext();
1534 assert(context);
1535 if (!context) {
1536 throw std::runtime_error("No OpenGL context attached");
1537 }
1538
1539 ramImage->pasteFrom(*image, image->getBounds(), false, context);
1540 ramImage->markForRendered(image->getBounds());
1541
1542 return ramImage;
1543}
1544
1545ImagePtr
1546EffectInstance::convertRAMImageToOpenGLTexture(const ImagePtr& image)

Callers

nothing calls this directly

Calls 6

pasteFromMethod · 0.80
getStorageModeMethod · 0.45
getParamsMethod · 0.45
getBoundsMethod · 0.45
markForRenderedMethod · 0.45

Tested by

no test coverage detected