Hello,

I've made a small change in the InitGLXP function and could get glxp
rendering to stop crashing gazebo. It still has some rendering problems
(specially when checking the frustrum option) but at least hw
acceleration is working.

My computer has a ATI Radeon xpress 200M ghaphic card with the ati-fglrx
driver installed.

Bests,
Pedro

int GLContext::InitGLXP( GLXContext shareList )
{
#ifdef HAVE_PBUFFER
  XVisualInfo *visual;
  GLXFBConfig config, *configs;
  int i;
  int nitems;

  // TODO: honor color bits request
  
  int attrib[]  =
    {
      //    GLX_DOUBLEBUFFER,  False,
      GLX_RED_SIZE,      1,
      GLX_GREEN_SIZE,    1,
      GLX_BLUE_SIZE,     1,
      GLX_DEPTH_SIZE,    this->reqDepth,
      GLX_RENDER_TYPE,   GLX_RGBA_BIT,
      //    GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
      None
    };

  int pbufAttrib[] =
    {
      GLX_PBUFFER_WIDTH,   this->reqWidth,
      GLX_PBUFFER_HEIGHT,  this->reqHeight,
      //    GLX_RENDER_TYPE,     GLX_RGBA_BIT,
      //    GLX_DEPTH_SIZE, this->reqDepth,
      GLX_LARGEST_PBUFFER, False,
      None
    };

  int a[10];
  
  PRINT_MSG0(2, "trying GLXP pbuffer rendering");

  config = NULL;
  configs = glXChooseFBConfig(::display,0,attrib,&nitems);
  PRINT_GL_ERR();
  if (!configs)
  {
    PRINT_MSG0(2, "unable to create GLXP pbuffer; no matching configs");
    return -1;
  }
  
  // Get the rendering context
  this->context = glXCreateNewContext(::display, configs[0],
GLX_RGBA_TYPE, 
                                      shareList, True);
  PRINT_GL_ERR();
  if (!this->context)
  {
    PRINT_MSG0(2, "unable to create context");
    return -1;
  }

  for (i=0;i<nitems;i++)
  {
    config = configs[i];
    this->pbuffer = glXCreatePbuffer(::display, config, pbufAttrib);
    PRINT_GL_ERR();
    if (this->pbuffer)
      break;
  }
  if (!this->pbuffer)
  {
    PRINT_MSG0(2, "unable to create GLXP pbuffer;");
    return -1;
  }
  
  // Use this buffer as our drawable
  this->drawable = pbuffer;
 
  // Get the visual
  visual = glXGetVisualFromFBConfig(::display, config);
  PRINT_GL_ERR();
  if (!visual)
  {
    PRINT_MSG0(2, "unable to get suitable visual");
    return -1;
  }

  glXGetFBConfigAttrib(::display, config, GLX_RED_SIZE, a + 0);
  glXGetFBConfigAttrib(::display, config, GLX_GREEN_SIZE, a + 1);
  glXGetFBConfigAttrib(::display, config, GLX_BLUE_SIZE, a + 2);
  glXGetFBConfigAttrib(::display, config, GLX_ALPHA_SIZE, a + 3);
  glXGetFBConfigAttrib(::display, config, GLX_DEPTH_SIZE, a + 4);
  
  // Print some info about the configuration
  PRINT_MSG6(1, "rendering: [GLXP pbuffer] direct [%s] RGBA [%d %d %d %
d] depth [%d]",
             (glXIsDirect(::display, this->context) ? "yes" : "no"), 
             a[0], a[1], a[2], a[3], a[4]);
  return 0;
#else
  PRINT_MSG0(2, "trying pbuffer rendering -- extension not present");
  return -1;
#endif
}



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Playerstage-gazebo mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo

Reply via email to