private void ClearBackground(uint cx, uint cy) { GSEffect solid = Obs.GetSolidEffect(); solid.SetParameterValue("color", new Vector4(0.0f, 0.0f, 0.0f, 1.0f)); GSEffectTechnique tech = solid.GetTechnique("Solid"); GS.TechniqueBegin(tech); GS.TechniqueBeginPass(tech, 0); GS.MatrixPush(); GS.MatrixIdentity(); GS.MatrixScale3f((float)cx, (float)cy, 1.0f); GS.LoadVertexBuffer(boxPrimitive); //draw solid black color over the scene GS.Draw(GSDrawMode.TrisStrip, 0, 0); GS.MatrixPop(); GS.TechniqueEndPass(tech); GS.TechniqueEnd(tech); GS.LoadVertexBuffer(null); }
private void DrawOutline(libobs.matrix4 matrix, float width, float height, float outlineThickness) { Vector3 scale = new Vector3(previewScale, previewScale, previewScale); libobs.matrix4_scale(out matrix, out matrix, out scale); GS.MatrixPush(); GS.MatrixIdentity(); GS.MatrixMul(matrix); float thickW = outlineThickness / width / previewScale; float thickH = outlineThickness / height / previewScale; GS.MatrixPush(); GS.MatrixScale3f(1.0f - thickW, thickH, 1.0f); GS.Draw(GSDrawMode.TrisStrip, 0, 0); GS.MatrixPop(); GS.MatrixPush(); GS.MatrixTranslate(new Vector3(1.0f, 0.0f, 0.0f)); GS.MatrixScale3f(-thickW, 1.0f - thickH, 1.0f); GS.Draw(GSDrawMode.TrisStrip, 0, 0); GS.MatrixPop(); GS.MatrixPush(); GS.MatrixTranslate(new Vector3(1.0f, 1.0f, 0.0f)); GS.MatrixScale3f(-1.0f + thickW, -thickH, 1.0f); GS.Draw(GSDrawMode.TrisStrip, 0, 0); GS.MatrixPop(); GS.MatrixPush(); GS.MatrixTranslate(new Vector3(0.0f, 1.0f, 0.0f)); GS.MatrixScale3f(thickW, -1.0f + thickH, 1.0f); GS.Draw(GSDrawMode.TrisStrip, 0, 0); GS.MatrixPop(); GS.MatrixPop(); }
protected override void AD2Draw(AD2SpriteBatch sb) { GS.Draw(sb); }