本文整理汇总了C#中RenderTexture.GetNativeTextureID方法的典型用法代码示例。如果您正苦于以下问题:C# RenderTexture.GetNativeTextureID方法的具体用法?C# RenderTexture.GetNativeTextureID怎么用?C# RenderTexture.GetNativeTextureID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderTexture
的用法示例。
在下文中一共展示了RenderTexture.GetNativeTextureID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cacheTextureValues
private bool syphonServerTextureValuesCached = false; // Do the server knows our camera size and id?
#endregion Fields
#region Methods
//
// Cache the current texture data to server
public void cacheTextureValues( RenderTexture rt )
{
if (rt.GetNativeTextureID() != 0 && rt.width != 0 && rt.height != 0) {
Syphon.CacheServerTextureValues(rt.GetNativeTextureID(), rt.width, rt.height, syphonServerTextureInstance);
cachedTexID = rt.GetNativeTextureID();
cachedWidth = rt.width;
cachedHeight = rt.height;
syphonServerTextureValuesCached = true;
}
}
示例2: SetStereoScreen
public override void SetStereoScreen(RenderTexture stereoScreen) {
#if UNITY_5 || !UNITY_IOS
SetTextureId(stereoScreen != null ? (int)stereoScreen.GetNativeTexturePtr() : 0);
#else
// Using old API for Unity 4.x and iOS because Metal crashes on GetNativeTexturePtr()
SetTextureId(stereoScreen != null ? stereoScreen.GetNativeTextureID() : 0);
#endif
}
示例3: OnRenderImage
//////////////////////////////////////////////////////////////
//
// GAME LOOP CALLBACKS -- In order they are called
//
//
// OnRenderImage() is called after all rendering is complete to render image, but the GUI is not rendered yet
// http://docs.unity3d.com/Documentation/ScriptReference/Camera.OnRenderImage.html
public void OnRenderImage(RenderTexture src, RenderTexture dst)
{
// Update texture data on Syphon server
if (!syphonServerTextureValuesCached || cachedTexID != src.GetNativeTextureID() || src.width != cachedWidth || src.height != cachedHeight)
cacheTextureValues( src );
// WITHOUT GUI: just blit to the screen and publish to syphon.
if (!renderGUI) {
// Copy src to dst
Syphon.SafeMaterial.SetPass(0);
Graphics.Blit(src, dst);
// Publish texture to Syphon Server
if (syphonServerTextureInstance != 0)
GL.IssuePluginEvent((int)syphonServerTextureInstance);
}
// WITH GUI: save reference to render textures
else {
srcTex = src;
dstTex = dst;
}
}
示例4: SetStereoScreen
public override void SetStereoScreen(RenderTexture stereoScreen) {
SetTextureId(stereoScreen != null ? stereoScreen.GetNativeTextureID() : 0);
}
示例5: SetStereoScreen
public override void SetStereoScreen(RenderTexture stereoScreen)
{
if (androidActivity != null) {
InitFromUnity(stereoScreen != null ? stereoScreen.GetNativeTextureID() : 0);
}
}
示例6: Awake
void Awake() {
if (sdk == null) {
sdk = this;
} else {
Debug.LogWarning("Cardboard SDK object should be a singleton.");
enabled = false;
}
config.initialize();
#if ANDROID_DEVICE
try {
AndroidJavaClass player = new AndroidJavaClass(cardboardClass);
cardboardActivity = player.CallStatic<AndroidJavaObject>("getActivity");
player.Dispose();
cardboardActivity.Call("initFromUnity", gameObject.name);
config.canAccessActivity = true;
} catch (AndroidJavaException e) {
Debug.LogError("Cannot access UnityCardboardActivity. "
+ "Verify that the jar is in Assets/Plugins/Android. " + e);
}
// Force side-effectful initialization using serialized values.
EnableAlignmentMarker = enableAlignmentMarker;
EnableSettingsButton = enableSettingsButton;
TapIsTrigger = tapIsTrigger;
#endif
if (config.canApplyDistortionCorrection()) {
Debug.Log("Creating new cardboard screen texture");
StereoScreen = new RenderTexture(Screen.width, Screen.height, 16,
RenderTextureFormat.RGB565);
StereoScreen.Create();
InitFromUnity(StereoScreen.GetNativeTextureID());
} else {
if (!Application.isEditor) {
Debug.LogWarning("Lens distortion-correction disabled. Causes: ["
+ config.getDistortionCorrectionDiagnostic() + "]");
}
}
InCardboard = newInCardboard = false;
#if UNITY_EDITOR
if (VRModeEnabled && Application.isPlaying) {
SetInCardboard(true);
}
#endif
StartCoroutine("EndOfFrame");
}
示例7: OnRenderImage
public void OnRenderImage(RenderTexture src, RenderTexture dst)
{
//if you don't want to render the gui, just blit to the screen, cache the texture values and pass the screen texture to syphon.
if(!renderGUI)
{
Graphics.Blit(src, dst);
if(!syphonServerTextureInstanceInitialized || src.width != storedWidth || src.height != storedHeight || storedTexID != src.GetNativeTextureID()){
storedWidth = src.width;
storedHeight = src.height;
storedTexID = src.GetNativeTextureID();
cacheTextureValues();
}
GL.IssuePluginEvent((int)syphonServerTextureInstance);
}
else{
if(tex == null || (!syphonServerTextureInstanceInitialized || src.width != storedWidth || src.height != storedHeight ||
storedTexID != src.GetNativeTextureID() )){
storedWidth = src.width;
storedHeight = src.height;
storedTexID = src.GetNativeTextureID();
tex = src;
cacheTextureValues();
}
}
}