美文网首页
BSPanoramaView 使用日记

BSPanoramaView 使用日记

作者: 淡淡_d108 | 来源:发表于2020-11-10 13:55 被阅读0次

    展示VR全景图,源码使用异步加载,实际使用时偶发崩溃,无法展示等问题。改为同步加载后暂未发现崩溃问题。

    - (void)setImageWithName:(UIImage*)imageName {

        self.shouldUnload = NO;

        NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], GLKTextureLoaderOriginBottomLeft, nil];

        UIImage *textureImage = imageName;//[UIImage imageNamed:imageName];

        if(textureImage.size.height* textureImage.size.width>4096.1f*2048.1f) {

            return;

        }

        NSError*error;

        GLKTextureInfo * _Nullable textureInfo = [GLKTextureLoader textureWithCGImage:textureImage.CGImage options:options error:&error];

        [[PanoramaManager sharedInstance] registerView:self];        [[PanoramaManager sharedInstance] unRegisterView:self];

            GLuintname = textureInfo.name;

            glDeleteTextures(1, &name);

            glDrawElements(GL_TRIANGLES, self.numIndices, GL_UNSIGNED_SHORT, 0);

        /// 设置着色器的纹理

        self.effect = [[GLKBaseEffect alloc] init];

        self.effect.texture2d0.enabled = GL_TRUE;

        self.effect.texture2d0.name= textureInfo.name;

    }

    相关文章

      网友评论

          本文标题:BSPanoramaView 使用日记

          本文链接:https://www.haomeiwen.com/subject/lgcjbktx.html