Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未在IOS设备上渲染QT图像_Ios_Qt_Opengl Es - Fatal编程技术网

未在IOS设备上渲染QT图像

未在IOS设备上渲染QT图像,ios,qt,opengl-es,Ios,Qt,Opengl Es,我只是加载图像并将其渲染到屏幕上: int oldFBO = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO); glBindFramebuffer(GL_FRAMEBUFFER, oldFBO); glViewport(0, 0, _width, _height); glClearColor(0.0,0.0,0.0,1.0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFF

我只是加载图像并将其渲染到屏幕上:

int oldFBO  = 0;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO);
glBindFramebuffer(GL_FRAMEBUFFER, oldFBO);
    glViewport(0, 0, _width, _height);

    glClearColor(0.0,0.0,0.0,1.0);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
    glDisable(GL_DEPTH_TEST);


    _program.bind();

    glBindBuffer(GL_ARRAY_BUFFER, _vbo);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*3, (GLvoid*)0);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, textureID);
    glUniform1i(glGetUniformLocation(_program.programId(), "u_texture"), 0);

    glDrawArrays(GL_TRIANGLES, 0, 6);
    glDisableVertexAttribArray(0);
正在加载图像:

QOpenGLTexture* depthImg;

if(!img.load(path.c_str()))
{
    qWarning("ERROR LOADING IMAGE");
    cout << "could not find the file: " << path << endl;
    return;
}else{
    cout << "loaded image: " << path << endl;
}

 depthImg = new QOpenGLTexture(img.mirrored());
 depthImg->setMinificationFilter(QOpenGLTexture::Nearest);
 depthImg->setMagnificationFilter(QOpenGLTexture::Linear);
我还尝试使用以下命令强制主函数中的glFormat:

QSurfaceFormat glFormat;
glFormat.setVersion(2, 1);
glFormat.setDepthBufferSize(24);
glFormat.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(glFormat);

我不知道为什么它在模拟器中构建没有问题,但在设备上没有显示任何内容

您是否尝试过在着色器中将highp更改为mediump?我相信不是GLE2上的所有设备都支持highp。不,我没有测试它。因为我曾经在我的iPhone设备上显示过图像。使用相同的应用程序。我只是改变了图像。这些图像具有相同的格式和相同的名称。我还删除了Xcode构建并让QT重新构建它。我还尝试从iPhone上卸载应用程序并重新安装。
QSurfaceFormat glFormat;
glFormat.setVersion(2, 1);
glFormat.setDepthBufferSize(24);
glFormat.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(glFormat);