public GuiRenderer(IGL owner) { Owner = owner; VertexLayout = owner.CreateVertexLayout(); VertexLayout.DefineVertexAttribute("aPosition", 0, 2, VertexAttribPointerType.Float, AttribUsage.Position, false, 32, 0); VertexLayout.DefineVertexAttribute("aTexcoord", 1, 2, VertexAttribPointerType.Float, AttribUsage.Texcoord0, false, 32, 8); VertexLayout.DefineVertexAttribute("aColor", 2, 4, VertexAttribPointerType.Float, AttribUsage.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(vsProgram, "vsmain", true); var ps = Owner.CreateFragmentShader(psProgram, "psmain", true); CurrPipeline = DefaultPipeline = Owner.CreatePipeline(VertexLayout, vs, ps, true, "xgui"); }
public RetroShader(IGL owner, string source, bool debug = false) { Owner = owner as IGL_TK; VertexLayout = owner.CreateVertexLayout(); VertexLayout.DefineVertexAttribute("VertexCoord", 0, 4, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 0); //VertexCoord VertexLayout.DefineVertexAttribute("ColorShit", 1, 4, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 16); //COLOR VertexLayout.DefineVertexAttribute("TexCoord", 2, 2, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 32); //TexCoord (is this vec2 or vec4? the glsl converted from cg had vec4 but the cg had vec2...) VertexLayout.Close(); string vsSource = "#define VERTEX\r\n" + source; string psSource = "#define FRAGMENT\r\n" + source; var vs = Owner.CreateVertexShader(vsSource, debug); var ps = Owner.CreateFragmentShader(psSource, debug); Pipeline = Owner.CreatePipeline(VertexLayout, vs, ps, debug); }
public RetroShader(IGL owner, string source, bool debug = false) { Owner = owner as IGL_TK; VertexLayout = owner.CreateVertexLayout(); VertexLayout.DefineVertexAttribute("VertexCoord", 0, 4, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 0); //VertexCoord VertexLayout.DefineVertexAttribute("ColorShit", 1, 4, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 16); //COLOR VertexLayout.DefineVertexAttribute("TexCoord", 2, 2, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 32); //TexCoord (is this vec2 or vec4? the glsl converted from cg had vec4 but the cg had vec2...) VertexLayout.Close(); string vsSource = "#define VERTEX\r\n" + source; string psSource = "#define FRAGMENT\r\n" + source; var vs = Owner.CreateVertexShader(vsSource, debug); var ps = Owner.CreateFragmentShader(psSource, debug); Pipeline = Owner.CreatePipeline(VertexLayout, vs, ps, debug); }
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(vsProgram, true); var ps = Owner.CreateFragmentShader(psProgram, true); CurrPipeline = DefaultPipeline = Owner.CreatePipeline(VertexLayout, vs, ps, true); }