Reply To: Frame rate issues in a client with Unity Syphon server

Home Forums Syphon Syphon Implementations – User Frame rate issues in a client with Unity Syphon server Reply To: Frame rate issues in a client with Unity Syphon server

#4913
WeivCo
Participant

All right, well I came out alive jumping into the deep end of XCode without really knowing that or Obj-C, so that’s good 😛

I added NSLog lines in the Unity plug-in when publishing and in Syphon in bindToDrawFrameOfSize and got these first few lines (2400×600 is just the current test res, my problem is occuring in 640×480 as well):

2011-10-11 19:06:25.031 Weiv 1.0 Demo[6692:207] creating Syphon Server
2011-10-11 19:06:25.032 Weiv 1.0 Demo[6692:207] Publishing to texture 2400, 600
2011-10-11 19:06:25.033 Weiv 1.0 Demo[6692:207] Rebuilding surface from 0.000000, 0.000000 to 2400.000000, 600.000000
2011-10-11 19:06:25.064 Weiv 1.0 Demo[6692:207] Publishing to texture 2400, 600

And I keep publishing till the server is destroyed. So the surface is only being rebuilt once it seems, which is good. Though I publish once first before rebuilding?

Yeah that line of code seems to fix some kind of weird UV issue or something. The effect seems to be that one pixel in the image is being sampled and drawn for the entire screen. A couple scenes we had triggered it, one of them when a camera was in a specific place and/or some sprites were being instantiated at a specific moment. Other scenes seemed to have it all the time. Changing to VertexLit rendering was a workaround, but I looked at your example script and reduced the fix down to that one line while maintaining a Unity-friendly OnRenderImage. I’m assuming that’s why the surface is being rebuilt from 0,0?

BTW our destroying happens here:

using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;

public class SyphonServer : MonoBehaviour {

	/* Nothing to be done for initialization */
	/* DLL is programmed to auto-initialize with "Weiv" upon first publish */

	/* Cleanup */
	[DllImport ("SyphonUnityPlugin")]
	private static extern void syphonServerDestroyResources();

	/* To help handle resizing */
	private float mScreenWidth;
	private float mScreenHeight;

	void Start ()
	{
		mScreenWidth = Screen.width;
		mScreenHeight = Screen.height;
	}

	void LateUpdate()
	{
		if ( Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer )
		{
			if ( mScreenWidth != Screen.width || mScreenHeight != Screen.height )
			{
				mScreenWidth = Screen.width;
				mScreenHeight = Screen.height;
				syphonServerDestroyResources( );
			}
		}
	}

	void OnApplicationQuit( )
	{
		if ( Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer )
		{
			/* Cleanup everything and close the server */
			syphonServerDestroyResources( );
		}
	}

}