{"action":"created","issue":{"url":"https://api.github.com/repos/LWJGL/lwjgl3/issues/311","repository_url":"https://api.github.com/repos/LWJGL/lwjgl3","labels_url":"https://api.github.com/repos/LWJGL/lwjgl3/issues/311/labels{/name}","comments_url":"https://api.github.com/repos/LWJGL/lwjgl3/issues/311/comments","events_url":"https://api.github.com/repos/LWJGL/lwjgl3/issues/311/events","html_url":"https://github.com/LWJGL/lwjgl3/issues/311","id":229087404,"number":311,"title":"LWJGL in non-main thread","user":{"login":"EmpsThomy","id":28254304,"avatar_url":"https://avatars0.githubusercontent.com/u/28254304?v=3","gravatar_id":"","url":"https://api.github.com/users/EmpsThomy","html_url":"https://github.com/EmpsThomy","followers_url":"https://api.github.com/users/EmpsThomy/followers","following_url":"https://api.github.com/users/EmpsThomy/following{/other_user}","gists_url":"https://api.github.com/users/EmpsThomy/gists{/gist_id}","starred_url":"https://api.github.com/users/EmpsThomy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EmpsThomy/subscriptions","organizations_url":"https://api.github.com/users/EmpsThomy/orgs","repos_url":"https://api.github.com/users/EmpsThomy/repos","events_url":"https://api.github.com/users/EmpsThomy/events{/privacy}","received_events_url":"https://api.github.com/users/EmpsThomy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-05-16T16:07:12Z","updated_at":"2017-06-16T19:19:10Z","closed_at":null,"body":"Hello,\r\n\r\nI'm creating an application where `lwjgl` is started in a non-main thread. It shouldn't be a problem, right?\r\n\r\nI use the following code: `\r\n\r\n\t\t\tglfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));\r\n\t\t\t\r\n\t\t\tif (!glfwInit()) {\r\n\t\t\t\tSystem.err.println(\"Couldn't initialize glfw context. Using software renderer.\");\r\n\t\t\t\tenabled = false;\r\n\t\t\t\treportOpenGLStartupError(null, \"glfwInit()\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\r\n\t\t\t// get monitor's size to set max width / height\r\n\t\t\tGLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());\r\n\t\t\tmaxWidth = videoMode.width();\r\n\t\t\tmaxHeight = videoMode.height();\r\n\r\n\t\t\t// set current heights\r\n\t\t\tint w = (int) (maxWidth * 0.7);\r\n\t\t\tint h = (int) (maxHeight * 0.7);\r\n\t\t\tif (w < 900)\r\n\t\t\t\tw = 900;\r\n\t\t\tif (h < 600)\r\n\t\t\t\th = 600;\r\n\t\t\t\r\n\t\t\tClient.clientWidth = width = frameWidth = w;\r\n\t\t\tClient.clientHeight = height = frameHeight = h;\r\n\r\n\t\t\t// resizable and \r\n\t\t\tglfwWindowHint(GLFW_RESIZABLE, 1);\r\n\t\t\tglfwWindowHint(GLFW_VISIBLE, 0);\r\n\t\t\t\r\n\t\t\twindow = glfwCreateWindow(width, height, \"Emps-World\", 0, 0);\r\n\t\t\tif (window == 0) {\r\n\t\t\t\tenabled = false;\r\n\t\t\t\tSystem.err.println(\"Couldn't initialize glfw window (\"+width+\"/\"+height+\"). Using software renderer.\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// make current window current contest and create GL capabilities\r\n\t\t\tglfwMakeContextCurrent(window);\r\n\t\t\tGL.createCapabilities();\r\n\t\t\tSystem.out.println(\"[GraphicsDisplay]: init(): current thread: \"+Thread.currentThread().getName());\r\n`\r\n\r\nNow this works on both, my laptop and on my Desktop computer. However, on another Windows 10 setup it crashes with following exception:\r\n`java.lang.IllegalStateException: There is no OpenGL context current in the current thread.`\r\n\r\nDo I have something wrong? Calling `glfwMakeContextCurrent(window);` should bind the current thread to the current `OpenGL Context`?\r\n\r\nThanks in advance!\r\nThomy\r\n"},"comment":{"url":"https://api.github.com/repos/LWJGL/lwjgl3/issues/comments/309112419","html_url":"https://github.com/LWJGL/lwjgl3/issues/311#issuecomment-309112419","issue_url":"https://api.github.com/repos/LWJGL/lwjgl3/issues/311","id":309112419,"user":{"login":"piegamesde","id":14054505,"avatar_url":"https://avatars0.githubusercontent.com/u/14054505?v=3","gravatar_id":"","url":"https://api.github.com/users/piegamesde","html_url":"https://github.com/piegamesde","followers_url":"https://api.github.com/users/piegamesde/followers","following_url":"https://api.github.com/users/piegamesde/following{/other_user}","gists_url":"https://api.github.com/users/piegamesde/gists{/gist_id}","starred_url":"https://api.github.com/users/piegamesde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piegamesde/subscriptions","organizations_url":"https://api.github.com/users/piegamesde/orgs","repos_url":"https://api.github.com/users/piegamesde/repos","events_url":"https://api.github.com/users/piegamesde/events{/privacy}","received_events_url":"https://api.github.com/users/piegamesde/received_events","type":"User","site_admin":false},"created_at":"2017-06-16T19:19:10Z","updated_at":"2017-06-16T19:19:10Z","body":"And how does this work on the larger scale level? In the OS, there _must_ be multiple OpenGL contexts open at the same time without problems, what's the difference there? Where does this limitation come from (Java, GLFW, OS allowing one context per process, ...)?"}}
{"actor":{"display_login":"piegamesde"}}