private void ApplyState() { // Apply RasterizerState now, as it depends on other device states GLDevice.ApplyRasterizerState( RasterizerState, RenderTargetCount > 0 ); while (ModifiedSamplers.Count > 0) { int sampler = ModifiedSamplers.Dequeue(); GLDevice.VerifySampler( sampler, Textures[sampler], SamplerStates[sampler] ); } // TODO: MSAA? if (VertexShader == null) { throw new InvalidOperationException("A vertex shader must be set!"); } if (PixelShader == null) { throw new InvalidOperationException("A pixel shader must be set!"); } if (vertexShaderDirty || pixelShaderDirty) { ActivateShaderProgram(); vertexShaderDirty = pixelShaderDirty = false; } vertexConstantBuffers.SetConstantBuffers(this, shaderProgram); pixelConstantBuffers.SetConstantBuffers(this, shaderProgram); }