本文整理汇总了C++中GLRenderSystem::find_shader方法的典型用法代码示例。如果您正苦于以下问题:C++ GLRenderSystem::find_shader方法的具体用法?C++ GLRenderSystem::find_shader怎么用?C++ GLRenderSystem::find_shader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLRenderSystem
的用法示例。
在下文中一共展示了GLRenderSystem::find_shader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glCreateProgram
GLMaterial::GLMaterial(GLRenderSystem& renderer, const Material& mat)
: _params(mat.default_params)
{
_id = glCreateProgram();
BufferID vShader = renderer.find_shader(mat.vertex_shader).get_id();
BufferID fShader = renderer.find_shader(mat.fragment_shader).get_id();
glAttachShader(_id, vShader);
glAttachShader(_id, fShader);
glBindAttribLocation(_id, 0, "vPosition");
glBindAttribLocation(_id, 1, "vTexCoord");
glBindAttribLocation(_id, 2, "vNormal");
glLinkProgram(_id);
// Make sure program successfully linked
GLint linked;
glGetProgramiv(_id, GL_LINK_STATUS, &linked);
if (!linked)
{
GLsizei length;
glGetProgramiv(_id, GL_INFO_LOG_LENGTH, &length);
GLchar* log = new GLchar[length + 1];
glGetProgramInfoLog(_id, length, &length, log);
Console::WriteLine("Material compilation failed: \"@\"", log);
delete[] log;
}
_model = glGetUniformLocation(_id, "model");
_view = glGetUniformLocation(_id, "view");
_projection = glGetUniformLocation(_id, "projection");
glDetachShader(_id, vShader);
glDetachShader(_id, fShader);
}