Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy Content of Hosted Silverlight Control

EDIT: Since my original problem was due to my mistake I will rephrase this question.

Im hosting a Silverlight in a window inside my C++ application based on the code found here.

Now I'd like to copy the content of the control to memory in order to use the content inside my own renderer. The problem I have is that when I set "EnableGPUAcceleration" to true, then BitBlt stops working, all I get is blackness.

I feel that in theory there should be a way to copy the content of a GPU-accelerated Silverlight control with its alpha, e.g. with something like glReadPixels.

Anyone got any idea as how to copy the content with alpha of a non-windowless gpu-accelerated Silverlight control?

Another problem is that the window must be visible and no other window may overlap it, otherwise I do not get the proper content. I would like the hosting window to be invisible.

Working sample code can be found here (although without the actual BitBlt"ting" that I'm trying to get to work).

like image 508
ronag Avatar asked Jan 24 '11 08:01

ronag


1 Answers

I will start researching this, I have an idea that OpenCL or perhaps since you are using Silverlight, DirectCompute may be able to set up a context where you can have more flexibility.

One way would be to simply do all GPU acceleration in one of those languages. Meanwhile I'll try to find out if you can use one of them to grab the information you need or some other techniques.

This link seems to verify that you will need GPU acceleration enabled across any interactive members.

EDIT:

I think that article may provide some other help to your issue. Essentially it is going to be about accessing the cache and ensuring that you are using the cache. Anything set to be in cache mode will be stored on the graphics card temporarily.

This article also sheds some light on the issues. Where it speaks on hardware rendering, it is important to note which operations would cause issues with the cache.

I must admit I'm not at all fluent in Silverlight, but these types of problems are familiar. Doing what I can to understand the situation of your code.

like image 124
Garet Claborn Avatar answered Oct 24 '22 06:10

Garet Claborn