/// <summary> Called before Render (normally by RenderList::Render) to set up data for the render. /// currentstate may be null, meaning, don't apply /// RenderState may be null, meaning don't change</summary> public void Bind(GLRenderState currentstate, IGLProgramShader shader, GLMatrixCalc matrixcalc) { if (currentstate != null && RenderState != null) // if either null, it means the last render state applied is the same as our render state, so no need to apply { currentstate.ApplyState(RenderState); // else go to this state } VertexArray?.Bind(); // give the VA a chance to bind to GL RenderData?.Bind(this, shader, matrixcalc); // optional render data supplied by the user to bind ElementBuffer?.BindElement(); // if we have an element buffer, give it a chance to bind IndirectBuffer?.BindIndirect(); // if we have an indirect buffer, give it a chance to bind ParameterBuffer?.BindParameter(); // if we have a parameter buffer, give it a chance to bind }