Axiom.Overlays.Elements.Panel.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( ) : void
return void
		public override void Initialize()
		{
			bool init = !isInitialized;
			base.Initialize();
			if ( init )
			{
				// setup the vertex data
				renderOperation.vertexData = new VertexData();

				// Vertex declaration: 1 position, add texcoords later depending on #layers
				// Create as separate buffers so we can lock & discard separately
				VertexDeclaration decl = renderOperation.vertexData.vertexDeclaration;
				decl.AddElement( POSITION, 0, VertexElementType.Float3, VertexElementSemantic.Position );
				renderOperation.vertexData.vertexStart = 0;
				renderOperation.vertexData.vertexCount = 4;

				// create the first vertex buffer, mostly static except during resizing
				HardwareVertexBuffer buffer =
					HardwareBufferManager.Instance.CreateVertexBuffer( decl.Clone( POSITION ), renderOperation.vertexData.vertexCount, BufferUsage.StaticWriteOnly );

				// bind the vertex buffer
				renderOperation.vertexData.vertexBufferBinding.SetBinding( POSITION, buffer );

				// no indices, and issue as a tri strip
				renderOperation.useIndices = false;
				renderOperation.operationType = OperationType.TriangleStrip;
				isInitialized = true;
			}
		}