本文整理汇总了C++中Shader::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::Initialize方法的具体用法?C++ Shader::Initialize怎么用?C++ Shader::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char * argv[])
{
glutInit(&argc , argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowPosition(0 , 0);
glutInitWindowSize(window_width, window_height);
glutCreateWindow("Warp");
glutDisplayFunc(DisplayFunc);
glutTimerFunc(1000 / 60, TimerFunc, 1000 / 60);
glutReshapeFunc(ReshapeFunc);
glutSpecialFunc(SpecialFunc);
glutKeyboardFunc(KeyboardFunc);
glutMouseFunc(MouseFunc);
glutMotionFunc(MotionFunc);
glutCloseFunc(CloseFunc);
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);
glEnable(GL_DEPTH_TEST);
ilInit();
iluInit();
ilutInit();
ilutRenderer(ILUT_OPENGL);
if (glewInit() != GLEW_OK)
{
cerr << "GLEW failed to initialize." << endl;
return 0;
}
if (!shader.Initialize("stub.vert", "stub.frag"))
{
return 0;
}
if (!background.Initialize("back.vert", "back.frag"))
{
return 0;
}
image_1_handle = ilutGLLoadImage("lotr-scene.jpg");
image_1_w = ilGetInteger(IL_IMAGE_WIDTH);
image_1_h = ilGetInteger(IL_IMAGE_HEIGHT);
tex_handle = ilutGLLoadImage("Home-Theater.jpg");
tex_w = ilGetInteger(IL_IMAGE_WIDTH);
tex_h = ilGetInteger(IL_IMAGE_HEIGHT);
left_overlay_handle = ilutGLLoadImage("left-over.jpg");
right_overlay_handle = ilutGLLoadImage("right-over.jpg");
left_curtain_handle = ilutGLLoadImage("left-curtain.jpg");
cout << "Image 1: " << image_1_w << " x " << image_1_h << endl;
cout << "Background: " << tex_w << " x " << tex_h << endl;
if (!frame.Initialize(glm::ivec2(image_1_w, image_1_h), 1, true))
{
cerr << "Frame buffer 1 failed to initialize." << endl;
return 0;
}
cout << "Window Size: " << window_width << " x " << window_height << endl;
cout << "Frame buffer 1 size: " << frame.size.x << " x " << frame.size.y << endl;
glutMainLoop();
return 0;
}
示例2: AddShader
void Graphics::AddShader(const std::string& name, Shader::ShaderCallback callback)
{
Shader* shader = graphicsAPI->MakeShader(name, callback);
shader->Initialize();
shaders_.insert(shader->GetName(), shader);
}