current revision
This commit is contained in:
31
ui/map/3D/gl/Shader.h
Normal file
31
ui/map/3D/gl/Shader.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef SHADER_H
|
||||
#define SHADER_H
|
||||
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
/**
|
||||
* just some helper methods
|
||||
*/
|
||||
class Shader {
|
||||
|
||||
private:
|
||||
|
||||
QOpenGLShaderProgram program;
|
||||
|
||||
public:
|
||||
|
||||
/** get the underlying program */
|
||||
QOpenGLShaderProgram* getProgram() {return &program;}
|
||||
|
||||
/** helper method to build the shader */
|
||||
void loadShaderFromFile(const QString& vertex, const QString& fragment) {
|
||||
if (!program.addShaderFromSourceFile(QOpenGLShader::Vertex, vertex)) {throw "1";}
|
||||
if (!program.addShaderFromSourceFile(QOpenGLShader::Fragment, fragment)) {throw "2";}
|
||||
if (!program.link()) {throw "3";}
|
||||
if (!program.bind()) {throw "4";}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // SHADER_H
|
||||
Reference in New Issue
Block a user