|
|
|
@ -32,48 +32,9 @@ |
|
|
|
|
|
|
|
|
|
package com.jme3.system.lwjgl; |
|
|
|
|
|
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_ALPHA_BITS; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_BLUE_BITS; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MAJOR; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MINOR; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_DEPTH_BITS; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_FALSE; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_GREEN_BITS; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_CORE_PROFILE; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_DEBUG_CONTEXT; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_FORWARD_COMPAT; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_PROFILE; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_RED_BITS; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_REFRESH_RATE; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_RESIZABLE; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_SAMPLES; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_SRGB_CAPABLE; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_STENCIL_BITS; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_STEREO; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_TRUE; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.GLFW_VISIBLE; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwCreateWindow; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwDefaultWindowHints; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwDestroyWindow; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwGetPrimaryMonitor; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwGetVideoMode; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwInit; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwMakeContextCurrent; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwPollEvents; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwSetErrorCallback; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwSetWindowFocusCallback; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwSetWindowIcon; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwSetWindowPos; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwSetWindowSizeCallback; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwSetWindowTitle; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwShowWindow; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwSwapBuffers; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwSwapInterval; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwWindowHint; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.glfwWindowShouldClose; |
|
|
|
|
import static org.lwjgl.glfw.GLFW.*; |
|
|
|
|
import static org.lwjgl.opengl.GL11.GL_FALSE; |
|
|
|
|
import static org.lwjgl.system.MemoryUtil.NULL; |
|
|
|
|
|
|
|
|
|
import com.jme3.input.JoyInput; |
|
|
|
|
import com.jme3.input.KeyInput; |
|
|
|
|
import com.jme3.input.MouseInput; |
|
|
|
@ -86,15 +47,10 @@ import com.jme3.system.JmeContext; |
|
|
|
|
import com.jme3.system.JmeSystem; |
|
|
|
|
import com.jme3.system.NanoTimer; |
|
|
|
|
import com.jme3.util.BufferUtils; |
|
|
|
|
|
|
|
|
|
import org.lwjgl.Version; |
|
|
|
|
import org.lwjgl.glfw.GLFWErrorCallback; |
|
|
|
|
import org.lwjgl.glfw.GLFWImage; |
|
|
|
|
import org.lwjgl.glfw.GLFWVidMode; |
|
|
|
|
import org.lwjgl.glfw.GLFWWindowFocusCallback; |
|
|
|
|
import org.lwjgl.glfw.GLFWWindowSizeCallback; |
|
|
|
|
import org.lwjgl.glfw.*; |
|
|
|
|
|
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
|
import java.nio.ByteBuffer; |
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
@ -196,12 +152,38 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { |
|
|
|
|
|
|
|
|
|
glfwDefaultWindowHints(); |
|
|
|
|
|
|
|
|
|
if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) { |
|
|
|
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); |
|
|
|
|
final String renderer = settings.getRenderer(); |
|
|
|
|
|
|
|
|
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); |
|
|
|
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); |
|
|
|
|
|
|
|
|
|
if (renderer.equals(AppSettings.LWJGL_OPENGL3)) { |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); |
|
|
|
|
} else if (renderer.equals(AppSettings.LWJGL_OPENGL33)) { |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); |
|
|
|
|
} else if (renderer.equals(AppSettings.LWJGL_OPENGL4)) { |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); |
|
|
|
|
} else if (renderer.equals(AppSettings.LWJGL_OPENGL41)) { |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); |
|
|
|
|
} else if (renderer.equals(AppSettings.LWJGL_OPENGL42)) { |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); |
|
|
|
|
} else if (renderer.equals(AppSettings.LWJGL_OPENGL43)) { |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); |
|
|
|
|
} else if (renderer.equals(AppSettings.LWJGL_OPENGL44)) { |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4); |
|
|
|
|
} else if (renderer.equals(AppSettings.LWJGL_OPENGL45)) { |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5); |
|
|
|
|
} else { |
|
|
|
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_FALSE); |
|
|
|
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); |
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); |
|
|
|
|
} |
|
|
|
|