示例#1
0
/* Create the WSEGL drawable version of a native window */
static WSEGLError wseglCreateWindowDrawable
    (WSEGLDisplayHandle display, WSEGLConfig *config,
     WSEGLDrawableHandle *drawable, NativeWindowType nativeWindow,
     WSEGLRotationAngle *rotationAngle)
{
    PvrQwsDrawable *draw;

    WSEGL_UNUSED(display);
    WSEGL_UNUSED(config);

    /* Check for special handles that indicate framebuffer screens */
    if (nativeWindow >= (NativeWindowType)0 &&
            nativeWindow < (NativeWindowType)PVRQWS_MAX_SCREENS) {
        PvrQwsDrawable *screen = pvrQwsScreenWindow((int)nativeWindow);
        if (!screen)
            return WSEGL_OUT_OF_MEMORY;
        *drawable = (WSEGLDrawableHandle)screen;
        if (!pvrQwsAllocBuffers(screen))
            return WSEGL_OUT_OF_MEMORY;
        *rotationAngle = wseglRotationValue(screen->rotationAngle);
        return WSEGL_SUCCESS;
    }

    /* The native window is the winId - fetch the underlying drawable */
    draw = pvrQwsFetchWindow((long)nativeWindow);
    if (!draw)
        return WSEGL_BAD_DRAWABLE;

    /* The drawable is ready to go */
    *drawable = (WSEGLDrawableHandle)draw;
    *rotationAngle = wseglRotationValue(draw->rotationAngle);
    if (!pvrQwsAllocBuffers(draw))
        return WSEGL_OUT_OF_MEMORY;
    return WSEGL_SUCCESS;
}
示例#2
0
//![0]
PvrEglScreen::PvrEglScreen(int displayId)
    : QGLScreen(displayId)
{
    setOptions(NativeWindows);
    setSupportsBlitInClients(true);
    setSurfaceFunctions(new PvrEglScreenSurfaceFunctions(this, displayId));
//![0]
    fd = -1;
    ttyfd = -1;
    doGraphicsMode = true;
    oldKdMode = KD_TEXT;
    parent = 0;

    // Make sure that the EGL layer is initialized and the drivers loaded.
    EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY);
    if (!eglInitialize(dpy, 0, 0))
        qWarning("Could not initialize EGL display - are the drivers loaded?");

    // Make sure that screen 0 is initialized.
    pvrQwsScreenWindow(0);
}