| #pragma once |
| |
| #ifndef SHADINGCONTEXT_H |
| #define SHADINGCONTEXT_H |
| |
| #include <memory> |
| |
| |
| #include <GL/glew.h> |
| |
| |
| #include "traster.h" |
| |
| |
| #include <QDateTime> |
| #include <QGLFramebufferObjectFormat> |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TNZSTDFX_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| |
| |
| |
| class QObject; |
| class QGLShaderProgram; |
| class QDateTime; |
| |
| |
| |
| class DVAPI ShadingContext { |
| public: |
| enum Support { OK, NO_PIXEL_BUFFER, NO_SHADERS }; |
| |
| public: |
| ShadingContext(); |
| ~ShadingContext(); |
| |
| |
| static Support support(); |
| |
| bool isValid() const; |
| |
| void makeCurrent(); |
| void doneCurrent(); |
| |
| |
| |
| |
| |
| |
| void resize(int lx, int ly, const QGLFramebufferObjectFormat &fmt = |
| QGLFramebufferObjectFormat()); |
| |
| QGLFramebufferObjectFormat format() const; |
| TDimension size() const; |
| |
| |
| |
| void addShaderProgram(const QString &shaderName, QGLShaderProgram *program); |
| void addShaderProgram(const QString &shaderName, QGLShaderProgram *program, |
| const QDateTime &lastModified); |
| bool removeShaderProgram(const QString &shaderName); |
| |
| QGLShaderProgram *shaderProgram(const QString &shaderName) const; |
| QDateTime lastModified(const QString &shaderName) const; |
| |
| std::pair<QGLShaderProgram *, QDateTime> shaderData( |
| const QString &shaderName) const; |
| |
| GLuint loadTexture(const TRasterP &src, GLuint texUnit); |
| |
| |
| |
| |
| |
| void unloadTexture(GLuint texId); |
| |
| |
| void draw(const TRasterP &dst); |
| |
| |
| void transformFeedback(int varyingsCount, const GLsizeiptr *varyingSizes, |
| GLvoid **bufs); |
| |
| private: |
| struct Imp; |
| std::unique_ptr<Imp> m_imp; |
| |
| |
| ShadingContext(const ShadingContext &); |
| ShadingContext &operator=(const ShadingContext &); |
| }; |
| |
| #endif // SHADINGCONTEXT_H |