当前位置: 首页>>代码示例>>C#>>正文


C# MonoTouch.GetWidthOfPlane方法代码示例

本文整理汇总了C#中MonoTouch.GetWidthOfPlane方法的典型用法代码示例。如果您正苦于以下问题:C# MonoTouch.GetWidthOfPlane方法的具体用法?C# MonoTouch.GetWidthOfPlane怎么用?C# MonoTouch.GetWidthOfPlane使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoTouch的用法示例。


在下文中一共展示了MonoTouch.GetWidthOfPlane方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderPixelBuffer

		public override void RenderPixelBuffer (MonoTouch.CoreVideo.CVPixelBuffer destinationPixelBuffer, MonoTouch.CoreVideo.CVPixelBuffer foregroundPixelBuffer, MonoTouch.CoreVideo.CVPixelBuffer backgroundPixelBuffer, float tween)
		{
			EAGLContext.SetCurrentContext (CurrentContext);

			if (foregroundPixelBuffer == null && backgroundPixelBuffer == null)
				return;

			var foregroundLumaTexture = LumaTextureForPixelBuffer (foregroundPixelBuffer);
			var foregroundChromaTexture = ChromaTextureForPixelBuffer (foregroundPixelBuffer);

			var backgroundLumaTexture = LumaTextureForPixelBuffer (backgroundPixelBuffer);
			var backgroundChromaTexture = ChromaTextureForPixelBuffer (backgroundPixelBuffer);

			var destLumaTexture = LumaTextureForPixelBuffer (destinationPixelBuffer);
			var destChromaTexture = ChromaTextureForPixelBuffer (destinationPixelBuffer);

			GL.UseProgram (ProgramY);

			// Set the render transformq
			float[] preferredRenderTransform = {
				RenderTransform.xx, RenderTransform.xy, RenderTransform.x0, 0.0f,
				RenderTransform.yx, RenderTransform.yy, RenderTransform.y0, 0.0f,
				0.0f, 				0.0f, 				1.0f, 				0.0f,
				0.0f,				0.0f,				0.0f,				1.0f
			};

			GL.UniformMatrix4 (Uniforms [(int)Uniform.Y], 1, false, preferredRenderTransform);

			GL.BindFramebuffer (FramebufferTarget.Framebuffer, (int)OffscreenBufferHandle);

			GL.Viewport (0, 0, destinationPixelBuffer.GetWidthOfPlane (0), destinationPixelBuffer.GetHeightOfPlane (0));

			// Y planes of foreground and background frame are used to render the Y plane of the destination frame
			GL.ActiveTexture (TextureUnit.Texture0);
			GL.BindTexture (foregroundLumaTexture.Target, foregroundLumaTexture.Name);
			GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);
			GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
			GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge);
			GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge);

			GL.ActiveTexture (TextureUnit.Texture1);
			GL.BindTexture (backgroundLumaTexture.Target, backgroundLumaTexture.Name);
			GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);
			GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
			GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge);
			GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge);

			GL.FramebufferTexture2D (FramebufferTarget.Framebuffer, FramebufferSlot.ColorAttachment0,
				destLumaTexture.Target, destLumaTexture.Name, 0);

			if (GL.CheckFramebufferStatus (FramebufferTarget.Framebuffer) != FramebufferErrorCode.FramebufferComplete) {
				Console.WriteLine ("Failed to make complete frmaebuffer object: " + 
					GL.CheckFramebufferStatus (FramebufferTarget.Framebuffer).ToString ());

				foregroundLumaTexture.Dispose ();
				foregroundChromaTexture.Dispose ();
				backgroundLumaTexture.Dispose ();
				backgroundChromaTexture.Dispose ();
				destLumaTexture.Dispose ();
				destChromaTexture.Dispose ();

				// Periodic texture cache flush every frame
				VideoTextureCache.Flush (MonoTouch.CoreVideo.CVOptionFlags.None);

				EAGLContext.SetCurrentContext (null);
			}

			GL.ClearColor (0f, 0f, 0f, 1f);
			GL.Clear (ClearBufferMask.ColorBufferBit);

			float[] quadVertexData1 = {
				-1.0f, 1.0f,
				1.0f, 1.0f,
				-1.0f, -1.0f,
				1.0f, -1.0f,
				1.0f, -1.0f,
			};
			// Compute the vertex data for the foreground frame at this instructionLerp 
			quadVertexCoordinates (ref quadVertexData1, ForegroundTrack, tween);

			// texture data varies from 0 -> 1, whereas vertex data varies from -1 -> 1
			float[] quadTextureData1 = {
				0.5f + quadVertexData1[0] / 2f, 0.5f + quadVertexData1[1] / 2f,
				0.5f + quadVertexData1[2] / 2f, 0.5f + quadVertexData1[3] / 2f,
				0.5f + quadVertexData1[4] / 2f, 0.5f + quadVertexData1[5] / 2f,
				0.5f + quadVertexData1[6] / 2f, 0.5f + quadVertexData1[7] / 2f,
				0.5f + quadVertexData1[8] / 2f, 0.5f + quadVertexData1[9] / 2f,
			};

			GL.Uniform1 (Uniforms [(int)Uniform.Y], 0f);

			GL.VertexAttribPointer<float> ((int)Attrib.Vertex_Y, 2, VertexAttribPointerType.Float, false, 0, quadVertexData1);
			GL.EnableVertexAttribArray ((int)Attrib.Vertex_Y);

			GL.VertexAttribPointer<float> ((int)Attrib.TexCoord_Y, 2, VertexAttribPointerType.Float, false, 0, quadTextureData1);
			GL.EnableVertexAttribArray ((int)Attrib.TexCoord_Y);

			GL.DrawArrays (BeginMode.TriangleStrip, 0, 5);

			float[] quadVertexData2 = {
//.........这里部分代码省略.........
开发者ID:RangoJT,项目名称:monotouch-samples,代码行数:101,代码来源:DiagonalWipeRenderer.cs


注:本文中的MonoTouch.GetWidthOfPlane方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。