本文整理汇总了C++中FrameBufferObject::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameBufferObject::Initialize方法的具体用法?C++ FrameBufferObject::Initialize怎么用?C++ FrameBufferObject::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameBufferObject
的用法示例。
在下文中一共展示了FrameBufferObject::Initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char * argv[])
{
window.timer_period = 1000 / 60;
glutInit(&argc , argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowPosition(0 , 0);
glutInitWindowSize(512 , 512);
if ((window.window_handle = glutCreateWindow("Frame Buffer Demo")) < 1)
{
cerr << "Window creation failed." << endl;
return 0;
}
if (glewInit() != GLEW_OK)
{
cerr << "Glew failed to initialize." << endl;
return 0;
}
if (!fbo.Initialize(glm::ivec2(512, 512), 2, true))
{
cerr << "Frame buffer failed to initialize." << endl;
return 0;
}
glutDisplayFunc(DisplayFunc);
glutReshapeFunc(ReshapeFunc);
glutKeyboardFunc(KeyboardFunc);
glutTimerFunc(window.timer_period, TimerFunc, 0);
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);
glutCloseFunc(CloseFunc);
glutMainLoop();
return 0;
}
示例2: main
int main(int argc, char * argv[])
{
glewInit();
glutInit(&argc, argv);
glutInitWindowSize(1024, 512);
glutInitWindowPosition(0, 0);
glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
//Initialize object's colors / values
torus.color = vec3(1.0f, 0.1f, 0.0f);
square.color1 = vec3(1.0, 1.0, 1.0);
square2.color1 = vec3(0.95f, 0.1f, 0.7f);
square2.color2 = vec3(1.0f, 1.0f, 0.0f);
disc.color = vec3(0.1f, 0.5f, 1.0f);
sphere.color = vec3(0.15f, 0.45f, 0.0f);
sphere2.color = vec3(0.45f, 0.05f, 0.25f);
cylinder.color = vec3(0.0f, 0.5f, 0.0f);
arena.texID = 18;
egg.texID = 20;
star.texID = 22;
magneton.texID = 25;
haunter.texID = 26;
frog.texID = 27;
goldeen.texID = 76;
rain2.color = vec3(0.4f, 0.4f, 1.0f);
snow2.color = vec3(1.0f, 1.0f, 1.0f);
fontfilename = "Pokemon.ttf";
//Initialize the precipitation
numParts = 300;
partX = new float[numParts];
partY = new float[numParts];
partOffset = new float[numParts];
for(int i=0; i<numParts; i++){
partX[i] = (float)(rand() % 1200);
partX[i] = (partX[i] - 600)/100;
partY[i] = (float)(rand() % 1200);
partY[i] = (partY[i] - 600)/100;
partOffset[i] = (float)(rand() % 360 + 1);
}
sphere.lava = true;sphere2.lava = false; //Initialize sphere statuses
window.window_handle = glutCreateWindow("Solar System");
glutReshapeFunc(ReshapeFunc);
glutCloseFunc(CloseFunc);
glutMotionFunc(mouseMovement);
glutPassiveMotionFunc(mouseMovement); //check for mouse movement
glutKeyboardFunc(KeyboardFunc);
glutSpecialFunc(SpecialFunc);
glutTimerFunc(window.interval, TimerFunc, 0);
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);
//Initialize everything
if (glewInit() != GLEW_OK)
{
cerr << "GLEW failed to initialize." << endl;
return 0;
}
init_resources();
glutDisplayFunc(DisplayFunc);
if (!fbo.Initialize(glm::ivec2(512, 512), 1, true)){
cerr << "Frame buffer failed to initialize." << endl;
return 0;
}
sph1.color = vec3(1.0f, 0.85f, 0.0f);
if (!sph1.Initialize(8,1.0f, "phong3.vert", "phong3.frag")){return 0;}
enm.color = vec3(0.75f, 0.0f, 0.75f);
if (!enm.Initialize(2,0.05f, "phong.vert", "phong.frag")){return 0;}
usr.color = vec3(0.0f, 0.0f, 0.5f);
if (!usr.Initialize(2,0.05f, "phong.vert", "phong.frag")){return 0;}
//if (!sb.Initialize()){return 0;}
//if (!coin.Initialize()){return 0;}
//if (!stadium.Initialize(0)){return 0;}
if (!skybox.Initialize(0, 5000, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;}
if (!skybox2.Initialize(1, 5025, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;}
if (!skybox3.Initialize(2, 5050, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;}
if (!skyboxUW.Initialize(3, 5075, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;}
arena.order = 1;
if (!sphere.Initialize(15, 1, "sphereShader2.vert", "sphereShader2.frag")){return 0;}
if (!sphere2.Initialize(15, 1, "sphereShader2.vert", "sphereShader2.frag")){return 0;}
if (!rain2.Initialize(2, 0.02f, "phong.vert", "phong.frag")){return 0;}
if (!snow2.Initialize(3, 0.02f, "phong.vert", "phong.frag")){return 0;}
//if (!egg.Initialize(15, 1, "./textures/alienEgg.jpg", "basic_texture_shader.vert", "basic_texture_shader.frag")){return 0;}
if (!square.Initialize(1, 3.0f, "phong.vert", "phong.frag")) {return 0;}
if (!sq4.Initialize(1, 5.0f, "basic_texture_shader.vert", "basic_texture_shader.frag")) {return 0;}
if (!disc.Initialize(8, 1.0f, "phong3.vert", "phong3.frag")) {return 0;}
if (!healthBar.Initialize(2, 1.0f, 1.f, 1.f, "phong3.vert", "phong3.frag")) {return 0;}
if (!soldier.Initialize()) {return 0;}
if (!ss.Initialize()) {return 0;}
//.........这里部分代码省略.........
示例3: 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;
}