Re: OpenGL context windows

New Message Reply Date view Thread view Subject view Author view

Anita Kishore (kishore++at++triavest.com)
Wed, 20 Aug 1997 10:08:25 -0700


On Aug 19, 9:19pm, Ryan McKinley wrote:
> Subject: OpenGL context windows
>
> Hi -
>
> I'm running Performer 2.1 on a single processor RE2. I want to open a
> single channel window, get keyPress information in that window, and be
> able to make OpenGL calls directly to that window. I know this is
> possible (it's in the FAQ) but I haven't had success with the OpenGL
> part.
>

The following works for me. But I use pf pipe window for rendering.

In the pipe window's config function, do:

        // register some keypress events
            Dsp = pfGetCurWSConnection();
            win = pfGetPWinWSWindow(pw);
            XSelectInput(Dsp, win, KeyPressMask);

In the channel draw function, do :

        pfClearChan(chan);
            pfDraw();
            // check for any keypress events
        GetXInput();

GetXInput() function has :

    pfWSConnection dsp = pfGetCurWSConnection();

    if (XEventsQueued(dsp, QueuedAfterFlush))
    {
        while (XEventsQueued(dsp, QueuedAlready))
        {
            XEvent event;
            XNextEvent(Dsp, &event);

            switch (event.type)
            {
                case KeyPress:
                {
                    char buf[100];
                    int rv;
                    KeySym ks;
                    rv = XLookupString(&event.xkey, buf, sizeof(buf), &ks, 0);

                    switch(ks)
                    {
                        case XK_F1:
                            printf("XK_F1 pressed\n");
                            break;
                    }
                  }
                }
            }
        }

This type of event checking is used in several of Pf sample programs that are
distributed.

Hope this helps.

-anita
kishore++at++triavest.com

-- 
Anita Kishore
=======================================================================
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:55:45 PDT

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