private CreateClientTexture ( IntPtr serverPtr ) : IntPtr | ||
serverPtr | IntPtr | |
return | IntPtr |
// private void InitSyphonClient(){ if(Application.isPlaying && attachedServer.SyphonServerPointer != IntPtr.Zero && !initialized){ //does not allocate GL resources: creates SyphonCacheData object on heap, saves ptr to Unity syphonClientPointer = Syphon.CreateClientTexture(attachedServer.SyphonServerPointer); // int texID = (int)attachedTexture.GetNativeTexturePtr(); // Syphon.CacheClientTextureValues(texID, attachedTexture.width, attachedTexture.height, syphonClientPointer); if(AnnounceClient != null) AnnounceClient(this); //do not mark as 'initialized yet- wait til we get a 'valid' texture ID. //this is because Unity (as of 4.2) no longer immediately returns a texture with a valid color backing on RT creation. //gets marked as initialized in the Render() method further below. } }
public void InitSyphonClient() { //call Syphon initialize method here. //if we have a valid syphon server attached, and not initialized yet, if (Application.isPlaying && attachedServer.SyphonServerPointer != 0 && !initialized) { // Debug.Log("EXECUTING syphon client: " + boundAppName + " " + boundName); attachedTexture.Create(); RenderTexture.active = attachedTexture; Graphics.Blit(Syphon.NullTexture, attachedTexture); RenderTexture.active = null; //RenderTexture.active = attachedTexture; syphonClientPointer = Syphon.CreateClientTexture(attachedServer.SyphonServerPointer); Syphon.CacheClientTextureValues(attachedTexture.GetNativeTextureID(), attachedTexture.width, attachedTexture.height, syphonClientPointer); initialized = true; if (AnnounceClient != null) { AnnounceClient(this); } } }