Hey guys,
I use a software called vvvv to generate graphic stuff and in the end I get a texture out of the renderer. Now I want to use this texture in unity. In vvvv I can use shared texture and get a pointer to the texture in memory.
Now I thought I could use the Texture2D.CreateExternalTexture function from unity to get access to this texture.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SharedTexture : MonoBehaviour {
System.IntPtr pointer;
// Use this for initialization
void Start () {
pointer = new System.IntPtr(1073760258);
}
// Update is called once per frame
void Update () {
Texture2D tex = Texture2D.CreateExternalTexture(1920,1080,TextureFormat.RGBA32,false,false, pointer);
GetComponent<Renderer>().material.mainTexture = tex;
}
}
where the number is the pointer.
But when I start this Unity instantly crashes. Do you know any solution for my problem?
Thank you very much!!