org.lwjgl.glfw.GLFW.glfwSwapInterval()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(327)

本文整理了Java中org.lwjgl.glfw.GLFW.glfwSwapInterval()方法的一些代码示例,展示了GLFW.glfwSwapInterval()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GLFW.glfwSwapInterval()方法的具体详情如下:
包路径:org.lwjgl.glfw.GLFW
类名称:GLFW
方法名:glfwSwapInterval

GLFW.glfwSwapInterval介绍

[英]Sets the swap interval for the current OpenGL or OpenGL ES context, i.e. the number of screen updates to wait from the time #glfwSwapBuffers was called before swapping the buffers and returning. This is sometimes called vertical synchronization, vertical retrace synchronization or just vsync.

A context that supports either of the WGL_EXT_swap_control_tear and GLX_EXT_swap_control_tear extensions also accepts negative swap intervals, which allows the driver to swap immediately even if a frame arrives a little bit late. You can check for these extensions with #glfwExtensionSupported. For more information about swap tearing, see the extension specifications.

A context must be current on the calling thread. Calling this function without a current context will cause a #GLFW_NO_CURRENT_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, see the present mode of your swapchain instead.

Note
  • This function may be called from any thread.
  • This function is not called during window creation, leaving the swap interval set to whatever is the default on that platform. This is done because some swap interval extensions used by GLFW do not allow the swap interval to be reset to zero once it has been set to a non-zero value.
  • Some GPU drivers do not honor the requested swap interval, either because of a user setting that overrides the application's request or due to bugs in the driver.
    [中]

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
public void setVSync(boolean vsync) {
  GLFW.glfwSwapInterval(vsync ? 1 : 0);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void setVSync(boolean vsync) {
  GLFW.glfwSwapInterval(vsync ? 1 : 0);
}

代码示例来源:origin: libgdx/libgdx

GLFW.glfwSwapInterval(config.vSyncEnabled ? 1 : 0);
GL.createCapabilities();

代码示例来源:origin: libgdx/libgdx

GLFW.glfwSwapInterval(config.vSyncEnabled ? 1 : 0);
GL.createCapabilities();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

glfwSwapInterval(1);
} else {
  glfwSwapInterval(0);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

glfwSwapInterval(1);
} else {
  glfwSwapInterval(0);

代码示例来源:origin: Renanse/Ardor3D

@Override
public void setVSyncEnabled(final boolean enabled) {
  GLFW.glfwSwapInterval(enabled ? 1 : 0);
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl3

@Override
public void setVSync(boolean vsync) {
  GLFW.glfwSwapInterval(vsync ? 1 : 0);
}

代码示例来源:origin: Renanse/Ardor3D

@Override
public void setVSyncEnabled(final boolean enabled) {
  GLFW.glfwSwapInterval(enabled ? 1 : 0);
}

代码示例来源:origin: sriharshachilakapati/SilenceEngine

/**
 * <p> This function sets the swap interval for the current context, i.e. the number of screen updates to wait from
 * the time {@link GLFW#glfwSwapBuffers(long)} was called before swapping the buffers and returning. This is
 * sometimes called vertical synchronization, vertical retrace synchronization or just vsync.</p>
 *
 * <p> Contexts that support either of the {@code WGL_EXT_swap_control_tear} and
 * {@code GLX_EXT_swap_control_tear} extensions also accept negative swap intervals, which allow the driver to
 * swap even if a frame arrives a little bit late. You can check for the presence of these extensions using {@link
 * GLFW#glfwExtensionSupported(CharSequence)}. For more information about swap tearing, see the extension
 * specifications.</p>
 *
 * <p> A context must be current on the calling thread. Calling this function without a current context will cause a
 * {@code GLFW_NO_CURRENT_CONTEXT} error.</p>
 *
 * @param i The number of screen updates to wait before swapping the buffers.
 */
public static void setSwapInterval(int i)
{
  glfwSwapInterval(i);
}

代码示例来源:origin: jsettlers/settlers-remake

public void async_init() {
  if(debug) {
    ec = GLFWErrorCallback.createPrint(System.err);
    GLFW.glfwSetErrorCallback(ec);
  }
  if(!GLFW.glfwInit()) throw new Error("glfwInit() failed!");
  GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_DEBUG_CONTEXT, debug ? GLFW.GLFW_TRUE : GLFW.GLFW_DONT_CARE);
  GLFW.glfwWindowHint(GLFW.GLFW_STENCIL_BITS, 1);
  glfw_wnd = GLFW.glfwCreateWindow(width + 1, width + 1, "lwjgl-offscreen", 0, 0);
  GLFW.glfwMakeContextCurrent(glfw_wnd);
  GLFW.glfwSwapInterval(0);
  event_converter.registerCallbacks();
}

代码示例来源:origin: fynnfluegge/oreon-engine

public void create()
{
  glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);    
  glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);	
  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);	
  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);    
  
  setId(glfwCreateWindow(getWidth(), getHeight(), getTitle(), 0, 0));
  
  if(getId() == 0) {
    throw new RuntimeException("Failed to create window");
  }
  
  setIcon("textures/logo/oreon_lwjgl_icon32.png");
  
  glfwMakeContextCurrent(getId());
  glfwSwapInterval(0);
  GL.createCapabilities();
}

代码示例来源:origin: badlogic/lwjgl3-maven-gradle

glfwSwapInterval(1);

代码示例来源:origin: badlogic/lwjgl3-maven-gradle

glfwSwapInterval(1);

代码示例来源:origin: playn/playn

glfwSwapInterval(1);
graphics.setSize(config.width, config.height, config.fullscreen);
glfwShowWindow(window);

代码示例来源:origin: lwjglgamedev/lwjglbook

glfwSwapInterval(1);

代码示例来源:origin: lwjglgamedev/lwjglbook

glfwSwapInterval(1);

代码示例来源:origin: lwjglgamedev/lwjglbook

glfwSwapInterval(1);

代码示例来源:origin: lwjglgamedev/lwjglbook

glfwSwapInterval(1);

代码示例来源:origin: lwjglgamedev/lwjglbook

glfwSwapInterval(1);

相关文章

GLFW类方法