当前位置: 首页>>代码示例>>C++>>正文


C++ Shader::Initialize方法代码示例

本文整理汇总了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;
}
开发者ID:c-day,项目名称:Warp,代码行数:67,代码来源:main.cpp

示例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);
 }
开发者ID:Marktopus,项目名称:WickedSickSingle,代码行数:6,代码来源:Graphics.cpp


注:本文中的Shader::Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。