glx 1.4 initialization

Any help would be appreciated…I started X programming and am trying to initialize an opengl window with this code but the GLXWindow refuses to becreated with a messaged of “failed to create drawable”.


	int attribs[] = {GLX_BUFFER_SIZE, 32,
					GLX_SAMPLE_BUFFERS, 0,
					GLX_RENDER_TYPE, GLX_RGBA_BIT,
					GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
					GLX_X_RENDERABLE, True,
					GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
					GLX_CONFIG_CAVEAT, GLX_NONE,
					GLX_TRANSPARENT_TYPE, GLX_NONE,
					GLX_DOUBLEBUFFER, True,
					GLX_STEREO, False,
					GLX_AUX_BUFFERS, 0,
					GLX_RED_SIZE, 8,
					GLX_GREEN_SIZE, 8,
					GLX_BLUE_SIZE, 8,
					GLX_ALPHA_SIZE, 8,
					GLX_DEPTH_SIZE, 24,
					GLX_STENCIL_SIZE, 8,
					None};
	int numOfConfigs;
	GLXFBConfig *config;
	int tmp;
	XVisualInfo *xvis;

	display = XOpenDisplay(NULL);
	if(glXQueryExtension(display, &tmp, &tmp))
		cout << "glX support found.
";

	config = glXChooseFBConfig(display, DefaultScreen(display), attribs, &numOfConfigs);
		cout << numOfConfigs << " configurations found.
";
	if((xvis = glXGetVisualFromFBConfig(display, *config))!= NULL)
		cout << "corresponding X visual found.
";

	if((context = glXCreateNewContext(display, *config, GLX_RGBA_TYPE, NULL, True))!=NULL)
		cout << "context created.
";

	win = XCreateWindow(display, DefaultRootWindow(display), 0, 0, 800, 600, 0,
		xvis->depth, InputOutput, xvis->visual,
		0, NULL);

	XMapRaised(display, win);

	glxwin = glXCreateWindow(display, *config, win, NULL);

	if(glXMakeContextCurrent(display, glxwin, glxwin, context))
		cout << "context binding successful.
";


	XFree(xvis);
	XFree(config);

Any suggestions welcome!
I’m using ubuntu intrepid with the open-source drivers(proprietary ones don’t work for now…)

None of the open-source drivers support GLX 1.4. You can onfirm this by running ‘glxinfo | grep “GLX version”’. Before attempting to use GLX 1.4 features (and you’re actually using a GLX 1.3 feature), you need to query the GLX version. See glXQueryVersion for details.

That said, all of the open-source drivers do support GLX_SGIX_fbconfig, which provides nearly identical functionality. Before trying to use that extension you’ll need to make sure it’s available by querying the GLX extension string. See glXQueryExtensionsString.

Since you’re getting the message “failed to create drawable,” I think you have a slightly old version of libGL. Before about 3 weeks ago there were a couple bugs in this area that cause some false errors.

Try this and tweak from there. Works for me. If you want a small complete glX program, just ask.

Yep, you were right, open source drivers support glx 1.2. It was the fglrx ati driver that advertised 1.4 but these drivers crashed so I uninstalled them…Will try the old initialization procedure until they are fixed.

I managed to make it work by substituting glxwin in
glXMakeContextCurrent(display, glxwin, glxwin, context)

with win(see code), without the glxCreateWindow call.

As said before, glx version is 1.2, GL_SGIX_fbconfig is supported and right now I’m gonna dig into some documentation to see what the hell is going on. Thnx,guys!