thorvg/src/lib/gl_engine/tvgGlProgram.h
Pranay Kumar Samanta af190033bb gl_engine: gradient implementation
Change-Id: If2413328437847d52ba1badc3b5c510fdd47ccd3
2020-09-08 14:45:48 +09:00

59 lines
2.3 KiB
C++
Executable file

/*
* Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _TVG_GL_PROGRAM_H_
#define _TVG_GL_PROGRAM_H_
#include "tvgGlShader.h"
#include <memory>
#include <map>
class GlProgram
{
public:
static std::unique_ptr<GlProgram> gen(std::shared_ptr<GlShader> shader);
GlProgram(std::shared_ptr<GlShader> shader);
~GlProgram();
void load();
static void unload();
int32_t getAttributeLocation(const char* name);
int32_t getUniformLocation(const char* name);
void setUniform1Value(int32_t location, int count, const int* values);
void setUniform2Value(int32_t location, int count, const int* values);
void setUniform3Value(int32_t location, int count, const int* values);
void setUniform4Value(int32_t location, int count, const int* values);
void setUniform1Value(int32_t location, int count, const float* values);
void setUniform2Value(int32_t location, int count, const float* values);
void setUniform3Value(int32_t location, int count, const float* values);
void setUniform4Value(int32_t location, int count, const float* values);
private:
void linkProgram(std::shared_ptr<GlShader> shader);
uint32_t mProgramObj;
static uint32_t mCurrentProgram;
};
#endif /* _TVG_GL_PROGRAM_H_ */