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; }
void Graphics::AddShader(const std::string& name, Shader::ShaderCallback callback) { Shader* shader = graphicsAPI->MakeShader(name, callback); shader->Initialize(); shaders_.insert(shader->GetName(), shader); }