#pragma once #include "GLExtensions.h" #include #include class RuntimeShaderRenderer { public: RuntimeShaderRenderer() = default; RuntimeShaderRenderer(const RuntimeShaderRenderer&) = delete; RuntimeShaderRenderer& operator=(const RuntimeShaderRenderer&) = delete; ~RuntimeShaderRenderer(); bool CommitFragmentShader(const std::string& fragmentShaderSource, std::string& error); bool HasProgram() const { return mProgram != 0; } void RenderFrame(uint64_t frameIndex, unsigned width, unsigned height); void ShutdownGl(); private: bool EnsureStaticGlResources(std::string& error); bool CompileShader(GLenum shaderType, const char* source, GLuint& shader, std::string& error) const; void DestroyProgram(); void DestroyStaticGlResources(); GLuint mProgram = 0; GLuint mVertexShader = 0; GLuint mFragmentShader = 0; GLuint mVertexArray = 0; GLuint mGlobalParamsBuffer = 0; };