本文整理汇总了C++中Shader::LoadFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::LoadFromFile方法的具体用法?C++ Shader::LoadFromFile怎么用?C++ Shader::LoadFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::LoadFromFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup_graphics
void setup_graphics(Device *device, int w, int h) {
device->render_state().SetWinSize(w, h);
depth_fbo.Init(w, h);
LOGI("Version : %s", RendererEnv::Version().c_str());
LOGI("Vendor : %s", RendererEnv::Vender().c_str());
LOGI("Renderer : %s", RendererEnv::Renderer().c_str());
LOGI("Extensions List");
auto ext_list = RendererEnv::ExtensionList();
auto ext_it = ext_list.begin();
auto ext_endit = ext_list.end();
for( ; ext_it != ext_endit ; ++ext_it) {
LOGI("%s", ext_it->c_str());
}
{
//create shader
string simple_vs_path = Filesystem::GetAppPath("shader/simple.vs");
string simple_fs_path = Filesystem::GetAppPath("shader/simple.fs");
simple_shader.LoadFromFile(simple_vs_path, simple_fs_path);
string color_vs_path = Filesystem::GetAppPath("shader/const_color.vs");
string color_fs_path = Filesystem::GetAppPath("shader/const_color.fs");
color_shader.LoadFromFile(color_vs_path, color_fs_path);
}
{
//post effect
string vs_path = Filesystem::GetAppPath("posteffect/shared.vs");
string to_grayscale_fs_path = Filesystem::GetAppPath("posteffect/to_grayscale.fs");
string null_fs_path = Filesystem::GetAppPath("posteffect/null.fs");
grayscale_post_effect.InitFromFile(vs_path, to_grayscale_fs_path);
null_post_effect.InitFromFile(vs_path, null_fs_path);
}
//lodepng
const char *texture_table[][2] = {
{ "sora", "texture/sora.png" },
{ "sora2", "texture/sora2.png" },
};
int tex_count = sizeof(texture_table) / sizeof(texture_table[0]);
for(int i = 0 ; i < tex_count ; i++) {
std::string tex_path = sora::Filesystem::GetAppPath(texture_table[i][1]);
sora::MemoryFile tex_file(tex_path);
tex_file.Open();
Texture tex(texture_table[i][0]);
tex.Init();
Image img;
img.LoadPNG(tex_file.start, tex_file.end - tex_file.start);
tex.LoadTexture(img);
device->tex_mgr()->Add(tex);
}
}