Re: xcb_create_colormap, how to use?

Thomas Fischer <[email protected]>
Newsgroups gmane.comp.freedesktop.xcb
Message-ID <CAGbX=_XQTxeuRKDHyHSswosc5AQ6jpeeSiSJVUchpvXxYKkhqg@mail.gmail.com>
Thanks, I actually managed to fix it, kinda by luck!

The code that didn't work was:

fb_configs = glXGetFBConfigs(display, default_screen, &num_fb_configs);
if(!fb_configs || num_fb_configs == 0)
{
    fprintf(stderr, "glXGetFBConfigs failed\n");
    return -1;
}
/* Select first framebuffer config and query visualID */
GLXFBConfig fb_config = fb_configs[0];
glXGetFBConfigAttrib(display, fb_config, GLX_VISUAL_ID , &visualID);

It was choosing a display that didn't have GLX_X_RENDERABLE set.

Using glXChooseFBConfig I was able to get it to work:
int visualID = 0;
static int visual_attribs[] =
{
    GLX_X_RENDERABLE, True,
    GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
    GLX_RENDER_TYPE, GLX_RGBA_BIT,
    GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
    GLX_RED_SIZE, 8,
    GLX_GREEN_SIZE, 8,
    GLX_BLUE_SIZE, 8,
    GLX_ALPHA_SIZE, 8,
    GLX_DEPTH_SIZE, 24,
    GLX_STENCIL_SIZE, 8,
    GLX_DOUBLEBUFFER, True,
    None
};

int num_fb_configs = 0;
GLXFBConfig *fb_configs = 0;
fb_configs = glXChooseFBConfig(display, default_screen, visual_attribs,
&num_fb_configs);

Is there any way I can update the page on the website with this working
code?


On Wed, Jun 6, 2018 at 11:03 AM, Uli Schlachter <[email protected]> wrote:

> Hi,
>
> On 05.06.2018 02:07, Thomas Fischer wrote:
> > I've been trying to compile the code from
> > https://xcb.freedesktop.org/opengl/
> > tl;dr: The code used Xlib to interact with glx, but uses xcb to handle X
> > events.
> >
> > It seems to not run because of something happening in
> xcb_create_colormap,
> >
> > I changed the code to use create_colormap_checked, and printed out the
> > error structure, this was the response, if it's useful:
> > =============ERROR=============
> > Could not create the colormap
> >         error->response_type: 0
> >         error->error_code: 8
> >         error->sequence: 31
> >         error->resource_id: 0
> >         error->minor_code: 0
> >         error->major_code: 78
> >         error->full_sequence: 31
> > ===============================
>
> Error 8 is XCB_MATCH / BadMatch.
>
> According to [1], CreateColormap produces a Match error if the visual is
> not supported by the screen. That's all that I can say, sorry. I know
> basically nothing about GLX. (Well, you could print out the value of
> visualID and look it up in the output of /usr/bin/xdpyinfo)
>
> Cheers,
> Uli
>
> [1]: https://www.x.org/releases/X11R7.5/doc/x11proto/proto.html
> --
> Homophobia - The fear that another man will treat you the way you treat
> women.
>

_______________________________________________
Xcb mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/xcb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.