Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.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
C++ SDL_CreateRenderer创建的渲染器无效_C++_Linux_Sdl 2 - Fatal编程技术网

C++ SDL_CreateRenderer创建的渲染器无效

C++ SDL_CreateRenderer创建的渲染器无效,c++,linux,sdl-2,C++,Linux,Sdl 2,我正在尝试通过执行以下操作在SDL2中创建渲染: SDL_Init(SDL_INIT_VIDEO); SDL_Window * w = SDL_CreateWindow("Window", 0, 0, 500, 500 0); SDL_Renderer * r = SDL_CreateRenderer(w, -1, 0); 但在SDL_CreateRenderer之后,我打印SDL_GetError(),它显示: 无效的渲染器 渲染时,某些东西渲染不好(这是游戏的一部分)。在windows上的

我正在尝试通过执行以下操作在SDL2中创建渲染:

SDL_Init(SDL_INIT_VIDEO);
SDL_Window * w = SDL_CreateWindow("Window", 0, 0, 500, 500 0);
SDL_Renderer * r = SDL_CreateRenderer(w, -1, 0);
但在SDL_CreateRenderer之后,我打印SDL_GetError(),它显示:

无效的渲染器

渲染时,某些东西渲染不好(这是游戏的一部分)。在windows上的同一台计算机中,它运行良好,并且不会显示“无效渲染器”错误

我首先用apt-get-install下载了SDL2,但后来我从源代码处编译了它,我仍然有同样的问题

我不确定这是否重要,但我正在用gnome外壳运行Ubuntu14.04。我有一个ati视频卡,我正在使用xserver xorg驱动程序。我使用的是fglrx,但它与SDL有另一个问题,所以我改变了它


有没有关于可能发生什么或如何修复的线索?

糟糕的渲染是因为缓冲区在使用前没有清理。我认为这与SDL_CreateRenderer有关,因为它在linux中显示了一个错误,而在ubuntu中没有显示,但很可能与此无关。

试试这个:
SDL_Renderer*r=SDL_CreateRenderer(w,-1,SDL_Renderer_软件)这也没用。错误仍然存在,但渲染不良的问题显然与此无关。这是因为图像缓冲区在使用前没有被清理。在windows中,无需清洗缓冲区即可正常工作。。不知道为什么。