1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef GLES_PROGRAM_H 16 #define GLES_PROGRAM_H 17 #include <memory> 18 #include "gles_sharder.h" 19 namespace OHOS { 20 namespace HDI { 21 namespace DISPLAY { 22 class GlesProgram { 23 public: GlesProgram()24 GlesProgram() {} 25 ~GlesProgram(); 26 GLuint Get() const; 27 bool Init(const std::string &vertexSharderSrc, const std::string &fragmentSharderSrc); 28 void Use() const; 29 void SetUniform(const GLchar *name, GLint value); 30 31 private: 32 std::unique_ptr<GlesSharder> vertexSharder_; 33 std::unique_ptr<GlesSharder> fragmentSharder_; 34 GLuint handle_ = 0; 35 }; 36 } 37 } 38 } 39 #endif // GLES_PROGRAM_H