[GRASS5] HAVE_PBUFFERS

Glynn Clements glynn.clements at virgin.net
Mon Aug 2 20:14:39 EDT 2004


Radim Blazek wrote:

> It is not our bug I think:
> do_zoom.c:281: `GLX_PBUFFER_WIDTH' undeclared (first use in this function)
> 
> I have in config.h
> /* define if glXCreatePbuffer exists */
> #define HAVE_PBUFFERS 1

That might indicate a mismatch between headers and library, although
I'm not certain. The configure test simply checks whether
glXCreatePbuffer exists in the library (checking whether a macro is
defined in a header is more work; you essentially have to compile and
link a test program).

The obvious fix is to conditionalise that code on whether
GLX_PBUFFER_{WIDTH,HEIGHT} are defined, i.e.:

	#ifdef HAVE_PBUFFERS
	#if defined(GLX_PBUFFER_WIDTH) && defined(GLX_PBUFFER_HEIGHT)
	    fprintf(stderr, "Creating PBuffer Using GLX 1.3\n");
	
	    fbc = glXChooseFBConfig(dpy, scr, 0, &elements);
	    if (fbc)
	    {
		pbuf_cnt = 0;
		pbuf_attrib[pbuf_cnt++] = GLX_PBUFFER_WIDTH;
		pbuf_attrib[pbuf_cnt++] = width + 1;
		pbuf_attrib[pbuf_cnt++] = GLX_PBUFFER_HEIGHT;
		pbuf_attrib[pbuf_cnt++] = height + 1;
	
		pbuffer = glXCreatePbuffer(dpy, fbc[0], pbuf_attrib);
		if (pbuffer)
		    glXMakeContextCurrent(dpy, pbuffer, pbuffer, ctx_orig);
	    }
	#endif
	#endif

All of the code which references pbuffer checks that it is non-null
(even if both the headers and libraries support pbuffers, the X server
might not).

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list