mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
40
drape/shader.cpp
Normal file
40
drape/shader.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "drape/shader.hpp"
|
||||
#include "drape/gl_functions.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
namespace
|
||||
{
|
||||
glConst ConvertType(Shader::Type t)
|
||||
{
|
||||
if (t == Shader::Type::VertexShader)
|
||||
return gl_const::GLVertexShader;
|
||||
|
||||
return gl_const::GLFragmentShader;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Shader::Shader(std::string const & shaderName, std::string const & shaderSource,
|
||||
std::string const & defines, Type type)
|
||||
: m_shaderName(shaderName)
|
||||
, m_glID(0)
|
||||
{
|
||||
m_glID = GLFunctions::glCreateShader(ConvertType(type));
|
||||
GLFunctions::glShaderSource(m_glID, shaderSource, defines);
|
||||
std::string errorLog;
|
||||
bool const result = GLFunctions::glCompileShader(m_glID, errorLog);
|
||||
CHECK(result, (m_shaderName, "> Shader compile error : ", errorLog));
|
||||
}
|
||||
|
||||
Shader::~Shader()
|
||||
{
|
||||
GLFunctions::glDeleteShader(m_glID);
|
||||
}
|
||||
|
||||
uint32_t Shader::GetID() const
|
||||
{
|
||||
return m_glID;
|
||||
}
|
||||
} // namespace dp
|
||||
Reference in New Issue
Block a user