Sat, 07 Mar 2020 01:20:36 +0200
negative axes are now drawn in darker color
#pragma once #include "common.h" class AbstractBasicShaderProgram : public QObject, protected QOpenGLFunctions { Q_OBJECT public: AbstractBasicShaderProgram(QObject* parent = nullptr); ~AbstractBasicShaderProgram() = default; void initialize(); Q_SLOT void setViewMatrix(const glm::mat4& newViewMatrix); Q_SLOT void setProjectionMatrix(const glm::mat4& newProjectionMatrix); Q_SLOT void setModelMatrix(const glm::mat4& newModelMatrix); void draw(); void teardown(); protected: void setMatrix(const char* name, const glm::mat4& matrix); void checkForGLErrors(); virtual const char* vertexShaderSource() const = 0; virtual const char* fragmentShaderSource() const = 0; virtual const void* vertexData() const = 0; virtual int vertexSize() const = 0; virtual int vertexCount() const = 0; virtual void setupVertexArrays() = 0; virtual GLenum drawMode() const = 0; bool isInitialized = false; QOpenGLBuffer buffer; QOpenGLShader vertexShader; QOpenGLShader fragmentShader; std::optional<gl::ShaderProgram> program{std::nullopt}; QOpenGLVertexArrayObject vertexArrayObject; };