void initGl() { RiftGlfwApp::initGl(); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LINE_SMOOTH); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); gl::clearColor(Colors::darkGrey); skyboxTexture = GlUtils::getCubemapTextures(Resource::IMAGES_SKY_CITY_XNEG_PNG); distortProgram = GlUtils::getProgram( Resource::SHADERS_TEXTURED_VS, Resource::SHADERS_RIFTWARP_FS); distortProgram->use(); distortProgram->setUniform1i("OffsetMap", 1); distortProgram->setUniform1i("Scene", 0); gl::Program::clear(); quadGeometry = GlUtils::getQuadGeometry(); frameBuffer.init(glm::uvec2(glm::vec2(eyeSize) * 2.0f)); OVR::HMDInfo hmdInfo; Rift::getHmdInfo(ovrManager, hmdInfo); RiftDistortionHelper distortionHelper(hmdInfo); FOR_EACH_EYE(eye) { eyes[eye].distortionTexture = distortionHelper.createLookupTexture(glm::uvec2(512, 512), eye); } }
void initGl() { RiftGlfwApp::initGl(); glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); glEnable(GL_PRIMITIVE_RESTART); glPrimitiveRestartIndex(UINT_MAX); glClearColor(0.1f, 0.1f, 0.1f, 1.0f); program = GlUtils::getProgram( Resource::SHADERS_TEXTURED_VS, Resource::SHADERS_TEXTURED_FS); program->use(); DistortionHelper distortionHelper(ovrHmdInfo); // Load scene textures and generate distortion meshes for_each_eye([&](StereoEye eye){ GlUtils::getImageAsTexture(textures[eye], SCENE_IMAGES[eye]); distortionGeometry[eye] = distortionHelper.createDistortionMesh(glm::uvec2(64, 64), eye); }); }