Java Code Examples for org.lwjgl.opengl.WGL#wglGetProcAddress()

The following examples show how to use org.lwjgl.opengl.WGL#wglGetProcAddress() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlatformWin32GLCanvas.java    From lwjgl3-awt with MIT License 5 votes vote down vote up
private void wglNvSwapGroupAndBarrier(GLData attribs, long bufferAddr, long hDC) throws AWTException {
    int success;
    long wglQueryMaxSwapGroupsNVAddr = WGL.wglGetProcAddress("wglQueryMaxSwapGroupsNV");
    success = JNI.callPPPI(hDC, bufferAddr, bufferAddr + 4, wglQueryMaxSwapGroupsNVAddr);
    int maxGroups = MemoryUtil.memGetInt(bufferAddr);
    if (maxGroups < attribs.swapGroupNV) {
        throw new AWTException("Swap group exceeds maximum group index");
    }
    int maxBarriers = MemoryUtil.memGetInt(bufferAddr + 4);
    if (maxBarriers < attribs.swapBarrierNV) {
        throw new AWTException("Swap barrier exceeds maximum barrier index");
    }
    if (attribs.swapGroupNV > 0) {
        long wglJoinSwapGroupNVAddr = WGL.wglGetProcAddress("wglJoinSwapGroupNV");
        if (wglJoinSwapGroupNVAddr == 0L) {
            throw new AWTException("WGL_NV_swap_group available but wglJoinSwapGroupNV is NULL");
        }
        success = JNI.callPI(hDC, attribs.swapGroupNV, wglJoinSwapGroupNVAddr);
        if (success == 0) {
            throw new AWTException("Failed to join swap group");
        }
        if (attribs.swapBarrierNV > 0) {
            long wglBindSwapBarrierNVAddr = WGL.wglGetProcAddress("wglBindSwapBarrierNV");
            if (wglBindSwapBarrierNVAddr == 0L) {
                throw new AWTException("WGL_NV_swap_group available but wglBindSwapBarrierNV is NULL");
            }
            success = JNI.callI(attribs.swapGroupNV, attribs.swapBarrierNV, wglBindSwapBarrierNVAddr);
            if (success == 0) {
                throw new AWTException("Failed to bind swap barrier. Probably no G-Sync card installed.");
            }
        }
    }
}
 
Example 2
Source File: PlatformWin32GLCanvas.java    From lwjgl3-awt with MIT License 5 votes vote down vote up
public boolean delayBeforeSwapNV(float seconds) {
    if (!wglDelayBeforeSwapNVAddr_set) {
        wglDelayBeforeSwapNVAddr = WGL.wglGetProcAddress("wglDelayBeforeSwapNV");
        wglDelayBeforeSwapNVAddr_set = true;
    }
    if (wglDelayBeforeSwapNVAddr == 0L) {
        throw new UnsupportedOperationException("wglDelayBeforeSwapNV is unavailable");
    }
    long hDC = User32.GetDC(hwnd);
    int ret = JNI.callPI(hDC, seconds, wglDelayBeforeSwapNVAddr);
    User32.ReleaseDC(hwnd, hDC);
    return ret == 1;
}
 
Example 3
Source File: PlatformWin32GLCanvas.java    From lwjgl3-swt with MIT License 5 votes vote down vote up
private void wglNvSwapGroupAndBarrier(GLData attribs, long bufferAddr, long hDC) throws SWTException {
    int success;
    long wglQueryMaxSwapGroupsNVAddr = WGL.wglGetProcAddress("wglQueryMaxSwapGroupsNV");
    success = JNI.callPPPI(hDC, bufferAddr, bufferAddr + 4, wglQueryMaxSwapGroupsNVAddr);
    int maxGroups = MemoryUtil.memGetInt(bufferAddr);
    if (maxGroups < attribs.swapGroupNV) {
        throw new SWTException("Swap group exceeds maximum group index");
    }
    int maxBarriers = MemoryUtil.memGetInt(bufferAddr + 4);
    if (maxBarriers < attribs.swapBarrierNV) {
        throw new SWTException("Swap barrier exceeds maximum barrier index");
    }
    if (attribs.swapGroupNV > 0) {
        long wglJoinSwapGroupNVAddr = WGL.wglGetProcAddress("wglJoinSwapGroupNV");
        if (wglJoinSwapGroupNVAddr == 0L) {
            throw new SWTException("WGL_NV_swap_group available but wglJoinSwapGroupNV is NULL");
        }
        success = JNI.callPI(hDC, attribs.swapGroupNV, wglJoinSwapGroupNVAddr);
        if (success == 0) {
            throw new SWTException("Failed to join swap group");
        }
        if (attribs.swapBarrierNV > 0) {
            long wglBindSwapBarrierNVAddr = WGL.wglGetProcAddress("wglBindSwapBarrierNV");
            if (wglBindSwapBarrierNVAddr == 0L) {
                throw new SWTException("WGL_NV_swap_group available but wglBindSwapBarrierNV is NULL");
            }
            success = JNI.callI(attribs.swapGroupNV, attribs.swapBarrierNV, wglBindSwapBarrierNVAddr);
            if (success == 0) {
                throw new SWTException("Failed to bind swap barrier. Probably no G-Sync card installed.");
            }
        }
    }
}
 
Example 4
Source File: PlatformWin32GLCanvas.java    From lwjgl3-swt with MIT License 5 votes vote down vote up
public boolean delayBeforeSwapNV(GLCanvas canvas, float seconds) {
    if (!wglDelayBeforeSwapNVAddr_set) {
        wglDelayBeforeSwapNVAddr = WGL.wglGetProcAddress("wglDelayBeforeSwapNV");
        wglDelayBeforeSwapNVAddr_set = true;
    }
    if (wglDelayBeforeSwapNVAddr == 0L) {
        throw new UnsupportedOperationException("wglDelayBeforeSwapNV is unavailable");
    }
    long hDC = User32.GetDC(canvas.handle);
    int ret = JNI.callPI(hDC, seconds, wglDelayBeforeSwapNVAddr);
    User32.ReleaseDC(canvas.handle, hDC);
    return ret == 1;
}