[GRASS5] HAVE_PBUFFERS

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

and Mesa 3.4.2. GLX_PBUFFER_WIDTH is missing (?):
http://freedesktop.org/cgi-bin/viewcvs.cgi/mesa/Mesa/include/GL/glx.h?r1=1.27&r2=1.28

Radim

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@virgin.net>