由于某些原因,我现在用的是QT3.8,然后我要用QT+SDL编程,
但是我用SDL_SetVideoMode函数无法得到返回值并且SDL_GetError没有任何提示。
ftgGlWidget::ftgGlWidget( QWidget* parent, const char* name )
: QWidget( parent)
{
//setUpdatesEnabled(false);
char variable[64];
sprintf(variable, "SDL_WINDOWID=0x%lx", this->winId());
putenv(variable);
if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
char err[256];
sprintf(err,"Unable to init SDL: %s\n", SDL_GetError());
QMessageBox::information(NULL,"Init",err);
return;
}
pScreen = SDL_SetVideoMode(this->width(), this->height(), 0, SDL_OPENGL);
if(pScreen==NULL)
{
char err[256];
sprintf(err,"Unable to init SDL: %s\n", SDL_GetError());
QMessageBox::information(NULL,"Init",err);
return;
}
}
还有就是我每次都有这样的提示
X Error: BadWindow (invalid Window parameter) 3
Major opcode: 3
Minor opcode: 0
Resource id: 0x4800012
然后把这行注释了就没这样的提示了。
pScreen = SDL_SetVideoMode(this->width(), this->height(), 0, SDL_OPENGL);
谁能帮我解决下。。。