At the moment my app takes the snapshot only through a GDI device (without using the CortSDK), and that works properly, but I have to integrate this feature with Cortona SDK and I invoked GetBuffer(&pBuff, &nBytes, &nWidth, &nHeight, &nBPP) from I3DViewService4 and I tried to convert it to a HBITMAP. For some reasons, I get a black bitmap instead of the real snapshot.
This code is here: http://rafb.net/p/fO9rla29.html
At a first glance, the code is quite OK, including commented out section with SetDIBitsToDevice. Provided that BITMAPINFO wrapped by CBitmapInfo is filled properly, there is no visible inconsistencies.
You can see the "pBuff" contents to be sure that it contains a valid data, not just 0x00s or 0xFFs.
Actually my task is very tricky. I'd like to generate jpg snapshots from every viewpoint, in a separate thread. First of all, is it possible? Can you recommend some general approach to this problem? It seems very hard to me, I don't know where to start.
No and again, no. Due to appartment model restrictions, you should perform all calls to Cortona in the same thread that created Cortona control. Do not call Cortona in a other threads.
Though you can copy all the data returned by I3DViewService4::GetBuffer to the memory block allocated by your application and then create the bitmap and pack it to JPEG in a separate thread.