예제 #1
0
JNIEXPORT void JNICALL
Java_sun_java2d_opengl_WGLGraphicsConfig_swapBuffers(JNIEnv *env,
                                                     jobject wglgc,
                                                     jlong pPeerData)
{
    HWND window;
    HDC hdc;

    J2dTraceLn(J2D_TRACE_INFO, "in WGLGraphicsConfig_swapBuffers");

    window = AwtComponent_GetHWnd(env, pPeerData);
    if (!IsWindow(window)) {
        J2dTraceLn(J2D_TRACE_ERROR, "disposed component");
        return;
    }

    hdc = GetDC(window);
    if (hdc == 0) {
        J2dTraceLn(J2D_TRACE_ERROR, "invalid hdc");
        return;
    }

    if (!SwapBuffers(hdc)) {
        J2dTraceLn(J2D_TRACE_ERROR, "error in SwapBuffers");
    }

    if (!ReleaseDC(window, hdc)) {
        J2dTraceLn(J2D_TRACE_ERROR, "error while releasing dc");
    }
}
예제 #2
0
void
OGLSD_SwapBuffers(JNIEnv *env, jlong pPeerData)
{
    HWND window;
    HDC hdc;

    J2dTraceLn(J2D_TRACE_INFO, "OGLSD_SwapBuffers");

    window = AwtComponent_GetHWnd(env, pPeerData);
    if (!IsWindow(window)) {
        J2dRlsTraceLn(J2D_TRACE_ERROR,
                      "OGLSD_SwapBuffers: disposed component");
        return;
    }

    hdc = GetDC(window);
    if (hdc == 0) {
        J2dRlsTraceLn(J2D_TRACE_ERROR,
                      "OGLSD_SwapBuffers: invalid hdc");
        return;
    }

    if (!SwapBuffers(hdc)) {
        J2dRlsTraceLn(J2D_TRACE_ERROR,
                      "OGLSD_SwapBuffers: error in SwapBuffers");
    }

    if (!ReleaseDC(window, hdc)) {
        J2dRlsTraceLn(J2D_TRACE_ERROR,
                      "OGLSD_SwapBuffers: error while releasing dc");
    }
}