本文整理汇总了C++中IVideoDriver::setShaderProgram方法的典型用法代码示例。如果您正苦于以下问题:C++ IVideoDriver::setShaderProgram方法的具体用法?C++ IVideoDriver::setShaderProgram怎么用?C++ IVideoDriver::setShaderProgram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVideoDriver
的用法示例。
在下文中一共展示了IVideoDriver::setShaderProgram方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initShaders
void PostProcess::initShaders()
{
if (PostProcess::shaderBlurH)
return;
file::Zips zp;
zp.add(system_data, system_size);
const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(IVideoDriver::instance->getVertexDeclaration(vertexPCT2::FORMAT));
file::buffer vs_h;
file::buffer vs_v;
file::buffer fs_blur;
zp.read("system/pp_hblur_vs.glsl", vs_h);
zp.read("system/pp_vblur_vs.glsl", vs_v);
zp.read("system/pp_rast_fs.glsl", fs_blur);
vs_h.push_back(0);
vs_v.push_back(0);
fs_blur.push_back(0);
unsigned int h = ShaderProgramGL::createShader(GL_VERTEX_SHADER, (const char*)&vs_h.front(), "", "");
unsigned int v = ShaderProgramGL::createShader(GL_VERTEX_SHADER, (const char*)&vs_v.front(), "", "");
unsigned int ps = ShaderProgramGL::createShader(GL_FRAGMENT_SHADER, (const char*)&fs_blur.front(), "", "");
IVideoDriver* driver = IVideoDriver::instance;
shaderBlurV = new ShaderProgramGL(ShaderProgramGL::createProgram(v, ps, decl));
driver->setShaderProgram(shaderBlurV);
driver->setUniformInt("s_texture", 0);
shaderBlurH = new ShaderProgramGL(ShaderProgramGL::createProgram(h, ps, decl));
driver->setShaderProgram(shaderBlurH);
driver->setUniformInt("s_texture", 0);
file::buffer vs_blit;
file::buffer fs_blit;
zp.read("system/pp_blit_vs.glsl", vs_blit);
zp.read("system/pp_blit_fs.glsl", fs_blit);
vs_blit.push_back(0);
fs_blit.push_back(0);
unsigned int vs = ShaderProgramGL::createShader(GL_VERTEX_SHADER, (const char*)&vs_blit.front(), "", "");
unsigned int fs = ShaderProgramGL::createShader(GL_FRAGMENT_SHADER, (const char*)&fs_blit.front(), "", "");
shaderBlit = new ShaderProgramGL(ShaderProgramGL::createProgram(vs, fs, decl));
driver->setShaderProgram(shaderBlit);
driver->setUniformInt("s_texture", 0);
}