Rendertexture problem on Mac

Hi,

to store a screenshot with a higher resolution, I use a RenderTexture (based on several threads).
This is working in the editor, but when I use it with a webplayer, the screenshot is stored correctly but then the viewer is flickering (sea attached image).

I have tried several things to release the RenderTexture but without success.

I have this problem only on Mac with Safari; I have no problems on WindowsXP with Firefox.

I am using Unity Pro.

function MakeScreenshot () {

var screenShotURL= “http://localhost:8888/image.php”;

screenshotCamera = Camera.main;

// We should only read the screen after all rendering is complete
yield WaitForEndOfFrame();

var l_width = Screen.width;
var l_height = Screen.height;
var rw : int = l_width * 2;
var rh : int = l_height * 2;

//All rendering goes into the active RenderTexture (active class property).
//If the active RenderTexture is null everything is rendered to the main window.

var rendert : RenderTexture;
rendert = RenderTexture.GetTemporary (rw, rh, 24);

RenderTexture.active = rendert;
screenshotCamera.targetTexture = rendert;

var tex = new Texture2D( rw, rh, TextureFormat.RGB24, false );

screenshotCamera.Render();

tex.ReadPixels( Rect(0, 0, rw, rh), 0, 0 );
tex.Apply();

// Encode texture into PNG
var bytes = tex.EncodeToPNG();
Destroy( tex );

// Create a Web Form
var form = new WWWForm();
form.AddField(“frameCount”, Time.frameCount.ToString());
var imageName=“”;
imageName=“screenShot.png”;
form.AddBinaryData(“image”, bytes, imageName, “image/png”);

// Upload to a cgi script
var w = WWW(screenShotURL, form);
yield w;
if (w.error != null)
print(w.error);
else {
Debug.Log (w.data);
print(“Finished Uploading Screenshot” + screenShotURL);
}

RenderTexture.ReleaseTemporary(rendert);
rendert = null;

screenshotCamera.targetTexture = null;
}

478043--16787--$error_on_mac.png

I’m having a similar flickering issue in Safari and Chrome for Mac (but not in Firefox for Mac). In my case, I’m not sure if it is caused by a Render Texture or by anything else, have you found any solution for your problem?

No - I haven’t found a solution. But I will try it with Firefox for Mac to find out whether my problem is similar to your problem.

I have also no problem when using Firefox for Mac

same problem here in

macbook pro with nvidia 320M
unity 3.3.0f4 mac os 10.6.7 firefox4
unity 2.6 mac os 10.6.7 safari
unity 2.6 mac os 10.6.7 firefox4

it did work here though:
unity 3.3.0f4 mac os 10.6.7 safari

I’ve got the exactly problem with RenderToTexture when running the project on web player. On MacOS it has the flickering issue. On windows side, the screen goes black.

Any light on the issue would be welcome.

So, I’m having the same problem here… And I noticed that in player log a message apear every time the problem occurs.

The log says that the engine was trying to release the used RenderTexture.active and so the engine would change the render context or release the RenderTexture.

If the engine release the rendering context or could not change it correctly, I think the rendering goes to space, lol.

And we developers can do nothing about that if it is an engine bug…

We continue waiting for corrections.

I think I found the problem.

You are trying to release ‘rendert’

But you cannot release the active RenderTexture. I don’t know why you made it active in first place, but if this is really needed, I sugest you save the active RenderTexture before you set ‘rendert’ to active, and before Releasing ‘rendert’, set it back to be the active RenderTexture.

I hope it helps,
cheers,