Beispiel #1
0
		public GuiRenderer(IGL owner)
		{
			Owner = owner;

			VertexLayout = owner.CreateVertexLayout();
			VertexLayout.DefineVertexAttribute("aPosition", 0, 2, VertexAttribPointerType.Float, AttributeUsage.Position, false, 32, 0);
			VertexLayout.DefineVertexAttribute("aTexcoord", 1, 2, VertexAttribPointerType.Float, AttributeUsage.Texcoord0, false, 32, 8);
			VertexLayout.DefineVertexAttribute("aColor", 2, 4, VertexAttribPointerType.Float, AttributeUsage.Texcoord1, false, 32, 16);
			VertexLayout.Close();

			_Projection = new MatrixStack();
			_Modelview = new MatrixStack();

			string psProgram, vsProgram;

			if (owner.API == "D3D9")
			{
				vsProgram = DefaultShader_d3d9;
				psProgram = DefaultShader_d3d9;
			}
			else
			{
				vsProgram = DefaultVertexShader_gl;
				psProgram = DefaultPixelShader_gl;
			}

			var vs = Owner.CreateVertexShader(false, vsProgram, "vsmain", true);
			var ps = Owner.CreateFragmentShader(false, psProgram, "psmain", true);
			CurrPipeline = DefaultPipeline = Owner.CreatePipeline(VertexLayout, vs, ps, true, "xgui");
		}
Beispiel #2
0
		public GuiRenderer(IGL owner)
		{
			Owner = owner;

			VertexLayout = owner.CreateVertexLayout();
			VertexLayout.DefineVertexAttribute("aPosition", 0, 2, VertexAttribPointerType.Float, false, 32, 0);
			VertexLayout.DefineVertexAttribute("aTexcoord", 1, 2, VertexAttribPointerType.Float, false, 32, 8);
			VertexLayout.DefineVertexAttribute("aColor", 2, 4, VertexAttribPointerType.Float, false, 32, 16);
			VertexLayout.Close();

			_Projection = new MatrixStack();
			_Modelview = new MatrixStack();

			var vs = Owner.CreateVertexShader(DefaultVertexShader,true);
			var ps = Owner.CreateFragmentShader(DefaultPixelShader, true);
			CurrPipeline = DefaultPipeline = Owner.CreatePipeline(VertexLayout, vs, ps, true);
		}
Beispiel #3
0
		public void MultiplyMatrix(MatrixStack ms) { MultiplyMatrix(ms.Top); IsDirty = true; }
Beispiel #4
0
		public void Begin(int width, int height)
		{
			Begin();

			Projection = Owner.CreateGuiProjectionMatrix(width, height);
			Modelview = Owner.CreateGuiViewMatrix(width, height);

			Owner.SetViewport(width, height);
		}
Beispiel #5
0
        public void Begin(int width, int height, bool yflipped = false)
        {
            Begin();

            Projection = Owner.CreateGuiProjectionMatrix(width, height);
            Modelview = Owner.CreateGuiViewMatrix(width, height);

            if (yflipped)
            {
                //not sure this is the best way to do it. could be done in the view matrix creation
                Modelview.Scale(1, -1);
                Modelview.Translate(0, -height);
            }
            Owner.SetViewport(width, height);
        }
 public void PostMultiplyMatrix(MatrixStack ms)
 {
     PostMultiplyMatrix(ms.Top); IsDirty = true;
 }