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

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

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

GLFW.glfwSwapBuffers介绍

[英]Swaps the front and back buffers of the specified window when rendering with OpenGL or OpenGL ES. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.

The specified window must have an OpenGL or OpenGL ES context. Specifying a window without a context will generate a #GLFW_NO_WINDOW_CONTEXT error.

This function does not apply to Vulkan. If you are rendering with Vulkan, vkQueuePresentKHR instead.

EGL: The context of the specified window must be current on the calling thread.

This function may be called from any thread.
[中]使用OpenGL或OpenGL ES进行渲染时交换指定窗口的前后缓冲区。如果交换间隔大于零,GPU驱动程序将在交换缓冲区之前等待指定数量的屏幕更新。
指定的窗口必须具有OpenGL或OpenGL ES上下文。指定没有上下文的窗口将生成#GLFW_NO_window_上下文错误。
此功能不适用于Vulkan。如果使用Vulkan进行渲染,请改为vkQueuePresentKHR。
EGL:指定窗口的上下文在调用线程上必须是当前的。
此函数可以从任何线程调用。

代码示例

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

private void createWindow(Lwjgl3Window window, Lwjgl3ApplicationConfiguration config, long sharedContext) {
  long windowHandle = createGlfwWindow(config, sharedContext);
  window.create(windowHandle);
  window.setVisible(config.initialVisible);
  for (int i = 0; i < 2; i++) {
    GL11.glClearColor(config.initialBackgroundColor.r, config.initialBackgroundColor.g, config.initialBackgroundColor.b,
        config.initialBackgroundColor.a);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    GLFW.glfwSwapBuffers(windowHandle);
  }
}

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

private void createWindow(Lwjgl3Window window, Lwjgl3ApplicationConfiguration config, long sharedContext) {
  long windowHandle = createGlfwWindow(config, sharedContext);
  window.create(windowHandle);
  window.setVisible(config.initialVisible);
  for (int i = 0; i < 2; i++) {
    GL11.glClearColor(config.initialBackgroundColor.r, config.initialBackgroundColor.g, config.initialBackgroundColor.b,
        config.initialBackgroundColor.a);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    GLFW.glfwSwapBuffers(windowHandle);
  }
}

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

boolean update() {
  if(!listenerInitialized) {
    initializeListener();
  }
  synchronized(runnables) {		
    executedRunnables.addAll(runnables);
    runnables.clear();
  }
  for(Runnable runnable: executedRunnables) {
    runnable.run();
  }
  boolean shouldRender = executedRunnables.size > 0 || graphics.isContinuousRendering();
  executedRunnables.clear();
  if (!iconified)
    input.update();
  
  synchronized (this) {
    shouldRender |= requestRendering && !iconified;
    requestRendering = false;
  }
  
  if (shouldRender) {
    graphics.update();
    listener.render();
    GLFW.glfwSwapBuffers(windowHandle);
  }
  if (!iconified)
    input.prepareNext();
  return shouldRender;
}

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

@Override
  public void invoke(long windowHandle, final int width, final int height) {
    updateFramebufferInfo();
    if (!window.isListenerInitialized()) {
      return;
    }
    window.makeCurrent();
    gl20.glViewport(0, 0, width, height);
    window.getListener().resize(getWidth(), getHeight());
    window.getListener().render();
    GLFW.glfwSwapBuffers(windowHandle);
  }
};

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

boolean update() {
  if(!listenerInitialized) {
    initializeListener();
  }
  synchronized(runnables) {		
    executedRunnables.addAll(runnables);
    runnables.clear();
  }
  for(Runnable runnable: executedRunnables) {
    runnable.run();
  }
  boolean shouldRender = executedRunnables.size > 0 || graphics.isContinuousRendering();
  executedRunnables.clear();
  if (!iconified)
    input.update();
  
  synchronized (this) {
    shouldRender |= requestRendering && !iconified;
    requestRendering = false;
  }
  
  if (shouldRender) {
    graphics.update();
    listener.render();
    GLFW.glfwSwapBuffers(windowHandle);
  }
  if (!iconified)
    input.prepareNext();
  return shouldRender;
}

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

@Override
  public void invoke(long windowHandle, final int width, final int height) {
    updateFramebufferInfo();
    if (!window.isListenerInitialized()) {
      return;
    }
    window.makeCurrent();
    gl20.glViewport(0, 0, width, height);
    window.getListener().resize(getWidth(), getHeight());
    window.getListener().render();
    GLFW.glfwSwapBuffers(windowHandle);
  }
};

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

glfwSwapBuffers(window);

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

glfwSwapBuffers(window);

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

public void update() {
  glfwSwapBuffers(windowHandle);
  glfwPollEvents();
}

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

public void update() {
  glfwSwapBuffers(windowHandle);
  glfwPollEvents();
}

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

public void update() {
    glfwSwapBuffers(windowHandle);
    glfwPollEvents();
  }
}

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

@Override
  public void doSwap() {
    if (Constants.stats) {
      StatCollector.startStat(StatType.STAT_DISPLAYSWAP_TIMER);
    }
    GLFW.glfwSwapBuffers(_windowId);
    if (Constants.stats) {
      StatCollector.endStat(StatType.STAT_DISPLAYSWAP_TIMER);
    }
  }
});

相关文章

GLFW类方法