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

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

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

GLFW.glfwGetCurrentContext介绍

[英]Returns the window whose OpenGL or OpenGL ES context is current on the calling thread.

This function may be called from any thread.
[中]返回其OpenGL或OpenGL ES上下文在调用线程上为当前的窗口。
此函数可以从任何线程调用。

代码示例

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

/**
 * Grab the current GLFW context.
 */
public void grabGLFWContext() {
  // get current conext
  wglGLFW = org.lwjgl.opengl.WGL.wglGetCurrentContext();
  glfwContext = org.lwjgl.glfw.GLFW.glfwGetCurrentContext();
}

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

if( retval == 0 ) {
  wglRM = org.lwjgl.opengl.WGL.wglGetCurrentContext();
  renderManagerContext = org.lwjgl.glfw.GLFW.glfwGetCurrentContext();
  shareContext();
  OsvrClientKitLibrary.osvrClientUpdate(context);

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

/**
 * This method returns the Window whose context is current on the thread that called this method.
 *
 * @return The window whose context is current in the current thread.
 */
public static Window getCurrentContext()
{
  return registeredWindows.get(glfwGetCurrentContext());
}

代码示例来源:origin: com.io7m.jcanephora/com.io7m.jcanephora.lwjgl3

@Override
public boolean contextIsCurrent()
{
 this.checkNotDestroyed();
 return GLFW.glfwGetCurrentContext() == this.context;
}

代码示例来源:origin: com.io7m.jcanephora/io7m-jcanephora-lwjgl3

@Override
public boolean contextIsCurrent()
{
 this.checkNotDestroyed();
 return GLFW.glfwGetCurrentContext() == this.context;
}

代码示例来源:origin: unascribed-archive/Visage

private boolean isKeyPressed(int key) {
  return glfwGetKey(glfwGetCurrentContext(), key) == GLFW_PRESS;
}

代码示例来源:origin: com.io7m.jcanephora/com.io7m.jcanephora.lwjgl3

@Override
public void contextDestroy()
 throws JCGLExceptionDeleted
{
 this.checkNotDestroyed();
 final long actual_current = GLFW.glfwGetCurrentContext();
 if (actual_current == this.context) {
  final StringBuilder sb = new StringBuilder(128);
  sb.append("Attempted to destroy a context that is still current.");
  sb.append(System.lineSeparator());
  sb.append("Context: 0x");
  sb.append(Long.toHexString(this.context));
  sb.append(System.lineSeparator());
  sb.append("Thread: ");
  sb.append(Thread.currentThread());
  sb.append(System.lineSeparator());
  final String m = sb.toString();
  LOG.error(m);
  throw new JCGLExceptionContextIsCurrent(m);
 }
 GLFW.glfwDestroyWindow(this.context);
 this.destroyed = true;
}

代码示例来源:origin: com.io7m.jcanephora/io7m-jcanephora-lwjgl3

@Override
public void contextDestroy()
 throws JCGLExceptionDeleted
{
 this.checkNotDestroyed();
 final long actual_current = GLFW.glfwGetCurrentContext();
 if (actual_current == this.context) {
  final StringBuilder sb = new StringBuilder(128);
  sb.append("Attempted to destroy a context that is still current.");
  sb.append(System.lineSeparator());
  sb.append("Context: 0x");
  sb.append(Long.toHexString(this.context));
  sb.append(System.lineSeparator());
  sb.append("Thread: ");
  sb.append(Thread.currentThread());
  sb.append(System.lineSeparator());
  final String m = sb.toString();
  LWJGL3Context.LOG.error(m);
  throw new JCGLExceptionContextIsCurrent(m);
 }
 GLFW.glfwDestroyWindow(this.context);
 this.destroyed = true;
}

代码示例来源:origin: com.io7m.jcanephora/com.io7m.jcanephora.lwjgl3

@Override
public void contextReleaseCurrent()
{
 this.checkNotDestroyed();
 if (LOG.isTraceEnabled()) {
  final Thread t = Thread.currentThread();
  LOG.trace(
   "release current (thread {} {})", Long.valueOf(t.getId()), t.getName());
 }
 final long actual_current = GLFW.glfwGetCurrentContext();
 if (actual_current == this.context) {
  GLFW.glfwMakeContextCurrent(MemoryUtil.NULL);
 } else {
  final StringBuilder sb = new StringBuilder(128);
  sb.append("Attempted to release a context that is not current.");
  sb.append(System.lineSeparator());
  sb.append("Context: 0x");
  sb.append(Long.toHexString(this.context));
  sb.append(System.lineSeparator());
  sb.append("Current context: 0x");
  sb.append(Long.toHexString(actual_current));
  sb.append(System.lineSeparator());
  sb.append("Thread: ");
  sb.append(Thread.currentThread());
  sb.append(System.lineSeparator());
  final String m = sb.toString();
  LOG.error(m);
  throw new JCGLExceptionContextNotCurrent(m);
 }
}

代码示例来源:origin: com.io7m.jcanephora/io7m-jcanephora-lwjgl3

@Override
public void contextReleaseCurrent()
{
 this.checkNotDestroyed();
 if (LWJGL3Context.LOG.isTraceEnabled()) {
  final Thread t = Thread.currentThread();
  LWJGL3Context.LOG.trace(
   "release current (thread {} {})", Long.valueOf(t.getId()), t.getName());
 }
 final long actual_current = GLFW.glfwGetCurrentContext();
 if (actual_current == this.context) {
  GLFW.glfwMakeContextCurrent(MemoryUtil.NULL);
 } else {
  final StringBuilder sb = new StringBuilder(128);
  sb.append("Attempted to release a context that is not current.");
  sb.append(System.lineSeparator());
  sb.append("Context: 0x");
  sb.append(Long.toHexString(this.context));
  sb.append(System.lineSeparator());
  sb.append("Current context: 0x");
  sb.append(Long.toHexString(actual_current));
  sb.append(System.lineSeparator());
  sb.append("Thread: ");
  sb.append(Thread.currentThread());
  sb.append(System.lineSeparator());
  final String m = sb.toString();
  LWJGL3Context.LOG.error(m);
  throw new JCGLExceptionContextNotCurrent(m);
 }
}

代码示例来源:origin: com.io7m.jcanephora/io7m-jcanephora-lwjgl3

final long actual_current = GLFW.glfwGetCurrentContext();
if (actual_current == MemoryUtil.NULL) {
 GLFW.glfwMakeContextCurrent(this.context);

代码示例来源:origin: com.io7m.jcanephora/com.io7m.jcanephora.lwjgl3

final long actual_current = GLFW.glfwGetCurrentContext();
if (actual_current == MemoryUtil.NULL) {
 GLFW.glfwMakeContextCurrent(this.context);

相关文章

GLFW类方法