Class WGLNVDelayBeforeSwap
- java.lang.Object
-
- org.lwjgl.opengl.WGLNVDelayBeforeSwap
-
public class WGLNVDelayBeforeSwap extends java.lang.Object
Native bindings to the WGL_NV_delay_before_swap extension.For most interactive applications, the standard rendering loop responding to input events on a frame granularity is sufficient. Some more demanding applications may want to exchange performance for the ability to sample input closer to the final frame swap and adjust rendering accordingly. This extension adds functionality to allow the application to wait until a specified time before a swapbuffers command would be able to execute.
Requires
OpenGL 2.1
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static boolean
wglDelayBeforeSwapNV(long hDC, float seconds)
Blocks the CPU untilseconds
seconds before a synchronized swap would occur on the window associated withhDC
.
-
-
-
Method Detail
-
wglDelayBeforeSwapNV
public static boolean wglDelayBeforeSwapNV(long hDC, float seconds)
Blocks the CPU untilseconds
seconds before a synchronized swap would occur on the window associated withhDC
. It also returns a boolean value equal toWinBase.TRUE
when the implementation had to wait for the synchronized swap andWinBase.FALSE
otherwise.The parameter
hDC
must be a valid device context associated with a graphic adapter. IfhDC
is not valid,WinBase.GetLastError()
will return WGL_INVALID_HDC,DelayBeforeSwapNV
will return FALSE and will not wait for the swap. IfhDC
is not associated with a graphic adapter,GetLastError
will return ERROR_DC_NOT_FOUND,DelayBeforeSwapNV
will return FALSE and will not wait for the swap.The parameter
seconds
accepts positive floating point values not larger than the length in seconds of the swap period on the associated window. When buffer swaps are synchronized, the swap period is composed of one or multiple video frame periods. A video frame period is the time required by the monitor to display a full frame of video data. A swap interval set to a value of 2 means that the color buffers will be swapped at most every other video frame. Ifseconds
is smaller than 0,GetLastError
will return ERROR_INVALID_DATA,DelayBeforeSwapNV
will return FALSE and will not wait for the end of the swap period. Ifseconds
is greater than a swap period,DelayBeforeSwapNV
will return immediately without generating any error and the return value will be FALSE.The application should use a
seconds
delay large enough to have time to complete its work before the end of the swap period. Ifseconds
is close to 0.0, the application may miss the end of the swap period and it will have to wait an additional swap period before it can swap.If
DelayBeforeSwapNV
detects that there is less thanseconds
seconds before the end of the swap period, it will return immediately and the return value will be FALSE. The implementation will not wait an additional video frame period to have an exact delay ofseconds
seconds.If buffer swaps are unsynchronized,
DelayBeforeSwapNV
will return immediately and the return value will be FALSE. It could happen for multiple reasons, for example if the swap interval is equal to 0, if the window is in a mode switch or if no monitors are active.- Parameters:
hDC
- a handle to the DCseconds
- the delay, in seconds
-
-