I think this is a FAQ, but I haven’t hit the right combination of search terms to find it.
My setup is a linux box running FC21 with the display variable set to point to an XMing server running on a Windows 7 laptop.
If I run the below application I get “Can’t create window: Couldn’t find matching GLX visual”
I believe the problem is that SDL2 is initializing the window trying to use client rendering, but I need server rendering. Server rendering works with GLUT-based opengl apps in this configuration.
So my question is: What can I do before trying to create the window to convince SDL2 to use server rendering? Or does SDL2 even support server rendering?
Thanks,
Marty
I neglected to add the code to the tail of the first message. Here it is.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <SDL2/SDL.h>
#include <GL/gl.h>
int main(int argc, char *argv[])
{
int final_status = 1;
SDL_Window *window;
SDL_GLContext openGL_context;
if (SDL_Init(SDL_INIT_VIDEO)) {
fprintf(stderr, "Unable to initialize SDL: %s\n",
SDL_GetError());
return 1;
}
window = SDL_CreateWindow("My Demo", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, 640, 480,
SDL_WINDOW_OPENGL);
if (!window) {
fprintf(stderr, "Can't create window: %s\n", SDL_GetError());
goto finished;
}
openGL_context = SDL_GL_CreateContext(window);
if (!openGL_context) {
fprintf(stderr, "Can't create openGL context: %s\n",
SDL_GetError());
goto close_window;
}
/* drawing code removed */
final_status = 0;
SDL_GL_DeleteContext(openGL_context);
close_window:
SDL_DestroyWindow(window);
finished:
SDL_Quit();
fprintf(stdout, “done\n”);
fflush(stdout);
return final_status;
}