ccShader.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. //##########################################################################
  3. //# #
  4. //# CCFBO #
  5. //# #
  6. //# This program is free software; you can redistribute it and/or modify #
  7. //# it under the terms of the GNU Library General Public License as #
  8. //# published by the Free Software Foundation; version 2 or later of the License. #
  9. //# #
  10. //# This program is distributed in the hope that it will be useful, #
  11. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  12. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  13. //# GNU General Public License for more details. #
  14. //# #
  15. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  16. //# #
  17. //##########################################################################
  18. #include "CCFbo.h"
  19. //Qt
  20. #include <QString>
  21. #include <QOpenGLShaderProgram>
  22. class QObject;
  23. //! Shader program
  24. /** Now a simple encapsulation of QOpenGLShaderProgram providing two helper functions.
  25. **/
  26. class CCFBO_LIB_API ccShader : public QOpenGLShaderProgram
  27. {
  28. Q_OBJECT
  29. public:
  30. //! Default constructor
  31. ccShader(QObject* parent = 0);
  32. //! Destructor
  33. virtual ~ccShader() = default;
  34. //! Creates program from two shader files with same base filename
  35. /** Path and extensions (.vert and .frag) are automatically
  36. added to shader base filename (shortcut to ccShader::loadProgram).
  37. \param shaderBasePath shader files path
  38. \param shaderBaseFilename shader base filename
  39. \param error error string (if any error occurred)
  40. \return success
  41. **/
  42. virtual bool fromFile(QString shaderBasePath, QString shaderBaseFilename, QString& error);
  43. //! Creates program from one or two shader files
  44. /** Filenames must be absolute (full path).
  45. \param vertShaderFile vertex shader filename
  46. \param fragShaderFile fragment shader filename
  47. \param error error string (if any error occurred)
  48. **/
  49. virtual bool loadProgram(QString vertShaderFile, QString fragShaderFile, QString& error);
  50. };