Performer -> Pixmap

New Message Reply Date view Thread view Subject view Author view

Andy Johnson (ajohnson++at++eecs.uic.edu)
Thu, 20 Mar 1997 20:53:41 -0600 (CST)


hi-ho

I'm trying to convince Performer 2.0/2.01 (C++, IRIX 6.2, on a variety of
SGI hardware - Indy, Impact, Onyx) to render into a pixmap instead of a
window, so the program will dump an image to a file at regular intervals
without having to open a window . I can dump the graphics using OpenGL, or
pfuSaveImage in a post-draw but then I need to have an unobscured window -
which I can't guarentee, so using a Pixmap seemed to be the solution ...
if it worked, that is :)

So the simple question is, can anyone supply some code and/or hints on how
to do this?

I have tried modifying simpleC.C but haven't had much luck with the code
below:

    Pixmap saveScrnPixmap;
    pfWSConnection dsp;
    pfGLContext context;
    XVisualInfo * visual;

    int attribList[64] = { GLX_DOUBLEBUFFER,
                                GLX_RGBA,
                                GLX_RED_SIZE, 1,
                                GLX_GREEN_SIZE, 1,
                                GLX_BLUE_SIZE, 1,
                                GLX_DEPTH_SIZE, 1,
                                None };

    // Configure and open GL window
    pfPipe *p = pfGetPipe(0);
    pfPipeWindow *pwin = new pfPipeWindow(p);

    dsp = pfOpenWSConnection(":0.0", True);

    saveScrnPixmap = XCreatePixmap(dsp, DefaultRootWindow(dsp),
                     300, 300, 24); // using 8 gives the same result

    visual = glXChooseVisual( dsp, DefaultScreen( dsp ), attribList);
    context = glXCreateContext(dsp, visual, 0, GL_TRUE);

    pwin->setWinType(PFPWIN_TYPE_X);
    pwin->setName("IRIS Performer");
    pwin->setOriginSize(0,0,300,300);

    pwin->setGLCxt(context);
    pwin->setWSDrawable(dsp, (pfWSDrawable) saveScrnPixmap);
    pwin->setFBConfig(visual);

// pwin->open(); X is very unhappy if I try an do this
// I can either have the setWSDrawable() or open()
// but not both ...

    .
    .
    .

    pfFrame();

    .
    .
    .

    if (saveScrnPixmap != NULL)
        {
        XpmAttributes saveAttributes;
        XpmWriteFileFromPixmap(dsp, "out.xpm", saveScrnPixmap, NULL,
                               &saveAttributes);
        }
    else
        printf("saveScrnPixmap is NULL!\n");

this code has a lot of fun creating what appears to be an infinitely big
out.xpm file on disc, or at least bigger than 60 meg.

I also tried letting performer open the window and then change the
WSdrawable to my pixmap, but X got upset about that as well.

thanks in advance for any help ...

=====================================================================
Andy Johnson
Electronic Visualization Lab (M/C 154) EVL phone (312) 996-3002
University of Illinois at Chicago EVL FAX (312) 413-7585
851 S. Morgan St. Room 1120 SEO ajohnson++at++eecs.uic.edu
Chicago, IL 60607-7053 www.eecs.uic.edu/~ajohnson

            "If it ain't real cute, it ain't real science"

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:56 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.