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

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

本文整理了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

  1. /**
  2. * Grab the current GLFW context.
  3. */
  4. public void grabGLFWContext() {
  5. // get current conext
  6. wglGLFW = org.lwjgl.opengl.WGL.wglGetCurrentContext();
  7. glfwContext = org.lwjgl.glfw.GLFW.glfwGetCurrentContext();
  8. }

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

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

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

  1. /**
  2. * This method returns the Window whose context is current on the thread that called this method.
  3. *
  4. * @return The window whose context is current in the current thread.
  5. */
  6. public static Window getCurrentContext()
  7. {
  8. return registeredWindows.get(glfwGetCurrentContext());
  9. }

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

  1. @Override
  2. public boolean contextIsCurrent()
  3. {
  4. this.checkNotDestroyed();
  5. return GLFW.glfwGetCurrentContext() == this.context;
  6. }

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

  1. @Override
  2. public boolean contextIsCurrent()
  3. {
  4. this.checkNotDestroyed();
  5. return GLFW.glfwGetCurrentContext() == this.context;
  6. }

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

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

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

  1. @Override
  2. public void contextDestroy()
  3. throws JCGLExceptionDeleted
  4. {
  5. this.checkNotDestroyed();
  6. final long actual_current = GLFW.glfwGetCurrentContext();
  7. if (actual_current == this.context) {
  8. final StringBuilder sb = new StringBuilder(128);
  9. sb.append("Attempted to destroy a context that is still current.");
  10. sb.append(System.lineSeparator());
  11. sb.append("Context: 0x");
  12. sb.append(Long.toHexString(this.context));
  13. sb.append(System.lineSeparator());
  14. sb.append("Thread: ");
  15. sb.append(Thread.currentThread());
  16. sb.append(System.lineSeparator());
  17. final String m = sb.toString();
  18. LOG.error(m);
  19. throw new JCGLExceptionContextIsCurrent(m);
  20. }
  21. GLFW.glfwDestroyWindow(this.context);
  22. this.destroyed = true;
  23. }

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

  1. @Override
  2. public void contextDestroy()
  3. throws JCGLExceptionDeleted
  4. {
  5. this.checkNotDestroyed();
  6. final long actual_current = GLFW.glfwGetCurrentContext();
  7. if (actual_current == this.context) {
  8. final StringBuilder sb = new StringBuilder(128);
  9. sb.append("Attempted to destroy a context that is still current.");
  10. sb.append(System.lineSeparator());
  11. sb.append("Context: 0x");
  12. sb.append(Long.toHexString(this.context));
  13. sb.append(System.lineSeparator());
  14. sb.append("Thread: ");
  15. sb.append(Thread.currentThread());
  16. sb.append(System.lineSeparator());
  17. final String m = sb.toString();
  18. LWJGL3Context.LOG.error(m);
  19. throw new JCGLExceptionContextIsCurrent(m);
  20. }
  21. GLFW.glfwDestroyWindow(this.context);
  22. this.destroyed = true;
  23. }

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

  1. @Override
  2. public void contextReleaseCurrent()
  3. {
  4. this.checkNotDestroyed();
  5. if (LOG.isTraceEnabled()) {
  6. final Thread t = Thread.currentThread();
  7. LOG.trace(
  8. "release current (thread {} {})", Long.valueOf(t.getId()), t.getName());
  9. }
  10. final long actual_current = GLFW.glfwGetCurrentContext();
  11. if (actual_current == this.context) {
  12. GLFW.glfwMakeContextCurrent(MemoryUtil.NULL);
  13. } else {
  14. final StringBuilder sb = new StringBuilder(128);
  15. sb.append("Attempted to release a context that is not current.");
  16. sb.append(System.lineSeparator());
  17. sb.append("Context: 0x");
  18. sb.append(Long.toHexString(this.context));
  19. sb.append(System.lineSeparator());
  20. sb.append("Current context: 0x");
  21. sb.append(Long.toHexString(actual_current));
  22. sb.append(System.lineSeparator());
  23. sb.append("Thread: ");
  24. sb.append(Thread.currentThread());
  25. sb.append(System.lineSeparator());
  26. final String m = sb.toString();
  27. LOG.error(m);
  28. throw new JCGLExceptionContextNotCurrent(m);
  29. }
  30. }

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

  1. @Override
  2. public void contextReleaseCurrent()
  3. {
  4. this.checkNotDestroyed();
  5. if (LWJGL3Context.LOG.isTraceEnabled()) {
  6. final Thread t = Thread.currentThread();
  7. LWJGL3Context.LOG.trace(
  8. "release current (thread {} {})", Long.valueOf(t.getId()), t.getName());
  9. }
  10. final long actual_current = GLFW.glfwGetCurrentContext();
  11. if (actual_current == this.context) {
  12. GLFW.glfwMakeContextCurrent(MemoryUtil.NULL);
  13. } else {
  14. final StringBuilder sb = new StringBuilder(128);
  15. sb.append("Attempted to release a context that is not current.");
  16. sb.append(System.lineSeparator());
  17. sb.append("Context: 0x");
  18. sb.append(Long.toHexString(this.context));
  19. sb.append(System.lineSeparator());
  20. sb.append("Current context: 0x");
  21. sb.append(Long.toHexString(actual_current));
  22. sb.append(System.lineSeparator());
  23. sb.append("Thread: ");
  24. sb.append(Thread.currentThread());
  25. sb.append(System.lineSeparator());
  26. final String m = sb.toString();
  27. LWJGL3Context.LOG.error(m);
  28. throw new JCGLExceptionContextNotCurrent(m);
  29. }
  30. }

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

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

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

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

相关文章

GLFW类方法