You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
912 B
31 lines
912 B
4 months ago
|
/*
|
||
|
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
|
||
|
* Description: ShaderProgram
|
||
|
* Author:
|
||
|
* Create: 2019-08-09
|
||
|
*/
|
||
|
|
||
|
#ifndef SHADER_PROGRAM_H
|
||
|
#define SHADER_PROGRAM_H
|
||
|
|
||
|
#include <string>
|
||
|
#include <GLES2/gl2.h>
|
||
|
#include "DFXDefine.h"
|
||
|
|
||
|
namespace dolgles {
|
||
|
class ShaderProgram {
|
||
|
public:
|
||
|
ShaderProgram();
|
||
|
~ShaderProgram();
|
||
|
GLuint CreateProgram(const std::string &vertexSource, const std::string &fragmentSource) const;
|
||
|
void ReleaseProgram(GLuint program) const;
|
||
|
GLint GetAttribLocation(GLuint program, const std::string &name) const;
|
||
|
GLint GetUniformLocation(GLuint program, const std::string &name) const;
|
||
|
private:
|
||
|
void PrintLog(GLuint object) const;
|
||
|
GLuint LoadShader(GLenum shaderType, const std::string &source) const;
|
||
|
GLuint LinkShaderProgram(GLuint vShader, GLuint fShader) const;
|
||
|
};
|
||
|
}; // namespace dolgles
|
||
|
|
||
|
#endif // end SHADER_PROGRAM_H
|