private void DisplayPipeline_PreDrawObjects(object sender, Rhino.Display.DrawEventArgs e) { GLShaderComponentBase.UpdateContext(e); if (_model.ProgramId != 0) { if (Rhino.Runtime.HostUtils.RunningOnWindows) { WindowsMethods.RHC_UpdateShader(_resourceName, _defines, _model.ProgramId); } else { MacMethods.RHC_UpdateShader(_resourceName, _defines, _model.ProgramId); } _model.RecycleCurrentProgram = false; } }
protected override void SolveInstance(IGH_DataAccess data) { string resourceName = ""; string defines = ""; data.GetData(0, ref resourceName); data.GetData(1, ref defines); defines = defines.Replace("\\n", "\n"); if (!resourceName.Equals(_resourceName) || !defines.Equals(_defines)) { _resourceName = resourceName; _defines = defines; _model = new GLSLViewModel(); } if (_model.ProgramId == 0 && !string.IsNullOrWhiteSpace(_model.VertexShaderCode) && !string.IsNullOrWhiteSpace(_resourceName)) { ActivateGL(); if (_model.CompileProgram()) { if (_model.ProgramId != 0) { if (Rhino.Runtime.HostUtils.RunningOnWindows) { WindowsMethods.RHC_UpdateShader(_resourceName, _defines, _model.ProgramId); } else { MacMethods.RHC_UpdateShader(_resourceName, _defines, _model.ProgramId); } _model.RecycleCurrentProgram = false; var doc = Rhino.RhinoDoc.ActiveDoc; if (doc != null) { doc.Views.Redraw(); } GLShaderComponentBase.RedrawViewportControl(); } } } }