From: leec@leland.Stanford.EDU (Christopher Lee)
Subject: single popup in GLX, fonts & other mixed model questions
Organization: DSG, Stanford University, CA 94305, USA
Date: Tue, 13 Oct 92 17:47:42 GMT


I am looking for some advice on GLX mixed model graphics programming.
Can anyone help me out on the following questions?

Yours Thankfully,

Chris Lee



1. How to allocate a single popup window in mixed model GLX?
I have an SGI code example (mixexamp.c) that successfully allocates a
popup together with a normal window, as follows...  (BTW, this fragment
calls three trivial functions: extract_visual, which returns the associated
visual; extract_value, which extracts the associated argument; and
set_window, which sets the associated GLX_WINDOW arg to the passed
window ID.)

/* ------------- This example works fine ----------------------- */
GLXconfig rgb_pup[] = {
        { GLX_NORMAL,   GLX_RGB,        True} ,
        { GLX_POPUP,    GLX_BUFSIZE,    2} ,
        { 0,            0,              0}
};

if ((conf = GLXgetconfig(D, S, rgb_pup)) == 0) {
  printf("getconfig failed\n");
  exit(1);
}
v = extract_visual(GLX_NORMAL, conf);
attr.colormap = extract_value(GLX_NORMAL, GLX_COLORMAP, conf);
attr.border_pixel = 0;
W = XCreateWindow(D, RootWindow(D, S), 0, 0, 400, 400, 0,
                  v->depth, InputOutput, v->visual,
                  CWBorderPixel|CWColormap, &attr);
set_window(GLX_NORMAL, W, conf);

v = extract_visual(GLX_POPUP, conf);
attr.colormap = extract_value(GLX_POPUP, GLX_COLORMAP, conf);
ovW = XCreateWindow(D, W, 0, 0, 400, 400, 0,
                    v->depth, InputOutput, v->visual,
                    CWBorderPixel|CWColormap, &attr);
set_window(GLX_POPUP, ovW, conf);

if (GLXlink(D, conf) < 0) {
  printf("Bind failed\n");
  exit(1);}





This is all very well if one wants to allocate a new normal window along
with every new popup.  However, when I try to allocate a popup all by
itself, as the child of a pre-existing normal window W...


/* ----------------  This doesn't work! ----------------- */
GLXconfig rgb_pup[] = {
        { GLX_POPUP,    GLX_BUFSIZE,    2} ,
        { 0,            0,              0}
};

    if ((conf = GLXgetconfig(D, S, rgb_pup)) == 0) {
      printf("getconfig failed\n");
      exit(1);
    }


    v = extract_visual(GLX_POPUP, conf);
    attr.colormap = extract_value(GLX_POPUP, GLX_COLORMAP, conf);
    ovW = XCreateWindow(D, W, 0, 0, 400, 400, 0,
                        v->depth, InputOutput, v->visual,
                        CWBorderPixel|CWColormap, &attr);
    set_window(GLX_POPUP, ovW, conf);

        /* Bind the GL to the created windows */
    if ((i=GLXlink(D, conf)) < 0) {
        printf("Can't bind popup, code = %d\n",i);
        exit(1);
    }

...the GLXlink call fails with return code -3.  I must be missing something
really basic.  What is the correct way to create a single popup window?
What am i doing wrong?




2. how to set GC for rendering operations & fonts?  Presumably the switch
to X was to allow us to use X methods for controlling windows, color,
line styles, events, etc.  How to set GC for drawing operations so that
we can control line dashing, font etc. using X?



3. how to force full-screen drawing, as needed for CrystalEyes stereo
drawing, etc?  Is there a good way to do this that doesn't wreak havoc on
the underlying windows, so that when the fullscreen window is unmapped,
they come back without any damage?




4. How to read dials & buttons in mixed model GLX?



5. What is the prefered text rendering method in GLX, and in OpenGL?
I notice that the font functions given under the rubric of <fmclient.h>
work under GLX.  Do they also work under OpenGL?  Is that how we are
supposed to render text, or are we supposed to use the X text functions?