Example #1
0
		public void setTextureAt (int sampler, TextureBase texture)
		{
			throw new NotImplementedException();
		}
Example #2
0
		public void setRenderToTexture(TextureBase texture, bool enableDepthAndStencil = false, int antiAlias = 0, 
		                               int surfaceSelector = 0) 
		{
			throw new NotImplementedException();
		}
Example #3
0
		public void setTextureAt (int sampler, TextureBase texture)
		{
			// see if texture changed
			if (mSamplerTextures[sampler] != texture)
			{
				// set sampler texture
				mSamplerTextures[sampler] = texture;

				// set flag indicating that this sampler is dirty
				mSamplerDirty |= (1 << sampler);
			}
		}
Example #4
0
		public void setRenderToTexture(TextureBase texture, bool enableDepthAndStencil = false, int antiAlias = 0, 
		                               int surfaceSelector = 0) {

			var texture2D = texture as Texture;
			if (texture2D == null) 
				throw new Exception("Invalid texture");

			GL.BindFramebuffer(FramebufferTarget.Framebuffer, mTextureFrameBufferId);
#if PLATFORM_MONOTOUCH
			GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferSlot.ColorAttachment0, TextureTarget.Texture2D, texture.textureId, 0);
#else
			GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, texture.textureId, 0);
#endif
			// setup viewport for render to texture
			GL.Viewport(0,0, texture2D.width, texture2D.height);

			// validate framebuffer status
			var code = GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer);
			if (code != FramebufferErrorCode.FramebufferComplete)
			{
				throw new Exception("FrameBuffer status error:" + code);
			}

			// invert the output y to flip the texture upside down when rendering
			mPositionScale[1] = -1.0f;
			if (mProgram != null) {
				mProgram.SetPositionScale(mPositionScale);
			}

			// save texture we're rendering to
			mRenderToTexture = texture;
		}
Example #5
0
		public void setRenderToTexture(TextureBase texture, bool enableDepthAndStencil = false, int antiAlias = 0, 
		                               int surfaceSelector = 0) {

			var texture2D = texture as Texture;
			if (texture2D == null) 
				throw new Exception("Invalid texture");

			GL.BindFramebuffer(FramebufferTarget.Framebuffer, mTextureFrameBufferId);
#if PLATFORM_MONOTOUCH
			GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferSlot.ColorAttachment0, TextureTarget.Texture2D, texture.textureId, 0);
#else
			GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, texture.textureId, 0);
#endif
			// setup viewport for render to texture
			// $$TODO figure out a way to invert the viewport vertically to account for GL's texture origin
			GL.Viewport(0,0, texture2D.width, texture2D.height);

			// validate framebuffer status
			var code = GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer);
			if (code != FramebufferErrorCode.FramebufferComplete)
			{
				throw new Exception("FrameBuffer status error:" + code);
			}

			// save texture we're rendering to
			mRenderToTexture = texture;
		}
Example #6
0
		public void setTextureAt (int sampler, TextureBase texture)
		{
			if (texture != null) {
				GL.ActiveTexture(TextureUnit.Texture0 + sampler);
				GL.BindTexture (texture.textureTarget, texture.textureId);
			} else {
				GL.ActiveTexture(TextureUnit.Texture0 + sampler);
				GL.BindTexture (TextureTarget.Texture2D, 0);
			}
		}