本文介绍了QPixmap图像加载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我正在尝试使用QPixmap将图像加载为纹理:

Basically I am trying to load the image as a texture using QPixmap:

texture[T_WALL] = bindTexture(QPixmap(":/images/wall.png"), GL_TEXTURE_2D);

该代码可在我的开发机上工作,但不适用于vm/其他没有QT的电脑.最初我使用jpegs,只是假设我弄乱了插件,但是据我了解,png文件不需要插件,所以我不知道问题出在哪里.

The code works on my development machine, but not in the vm / other pcs without QT. Initially I was using jpegs and just assumed that I messed up the plugins, but as I understand, no plugins are needed for png files so I have no idea where the problem is.

加载本地文件和使用Qt资源时,结果是相同的.

Results are the same when loading local files and using Qt resources.

我正在部署libgcc_s_dw2-1.ddl,mingwm10.dll,QtCore4.dll,QtGui4.dll,QtOpenGL4.dll.我还需要其他东西吗?

I am deploying libgcc_s_dw2-1.ddl, mingwm10.dll, QtCore4.dll, QtGui4.dll, QtOpenGL4.dll. Do I need anything else?

推荐答案

尝试将imageformats目录添加到您的应用程序目录中,然后将qmng4.dll放在此处.请参阅我对问题的回答在Windows上部署Qt dll 如果仍然无法正常运行,请获取包含dgbview.exe的 Sysinternals套件.允许您观看qDebug消息(甚至对于发行版).

Try adding an imageformats directory to your application directory and put qmng4.dll there. See my answer to the question Qt dll deployment on windowsIf it still does not work, get the Sysinternals suite which contains dgbview.exe that allows you to watch qDebug messages (even for release builds).

这篇关于QPixmap图像加载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 13:10