globals ======= #import "ContactCOM.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids // Scene Access Library #include "Contact3DInterface.h" #include "D3D9TYPES.h" CComQIPtr bufferTexture; int width; int height; int levels; int format; BYTE* tempBuffer; BYTE frame; getting BufferTexture interface =============================== HRESULT hr; CComPtr browser; browser.Attach((Browser*)ContactOCX.getObject(BROWSER_OBJECT_BROWSER)); CComPtr nodeA; CComPtr nodePathA; tempBuffer = NULL; frame=128; hr = browser->getNode(L"BUFFER-TEXTURE",&nodeA); if (SUCCEEDED(hr)) { bufferTexture = nodeA; // may fail because not yet created hr= bufferTexture->getFormat( &width, &height, &levels, &format); } creating memory buffer and writing to texture ====================== if (bufferTexture) { HRESULT hr; // create buffer if (!tempBuffer) { hr= bufferTexture->getFormat( &width, &height, &levels, &format); if (SUCCEEDED(hr)) { ASSERT(format == D3DFMT_X8R8G8B8); tempBuffer = (BYTE *)_aligned_malloc(width*height*4,32); } } if (tempBuffer) { FillMemory(tempBuffer, width*height*4,frame); frame+=9; /* //generic slower D3DX9Version with format conversion hr= bufferTexture->setTextureEx( width, height, 0, format, width*height*4, tempBuffer, width*4); */ //SSE2 native format version hr= bufferTexture->setTexture( 0, width*height*4, tempBuffer, width*4); }