Hello all,
So after about 3 hours of updating, I finaly corrected all IDE errors with LWJGL 3.0.0a. However no game are running with the GameEngine. All games throws IllegalStateException : No OpenGL context is current in the current thread.
I don't know why it's happening I called GLContext.createFromCurrent after glfwMakeContextCurrent but it still throws the same error, and no windows are opening just the proload works fine (version/credits/logger creation).
Here is the code of the main GameEngine thread which manages all the load stuff :
public void run() {
try {
glfwDefaultWindowHints();
glfwWindowHint(GLFW_RESIZABLE, GL11.GL_FALSE);
glfwWindowHint(GLFW_VISIBLE, GL11.GL_TRUE);
if (isWindowed) {
gameWindow = glfwCreateWindow(sizeX, sizeY, gameName, NULL, NULL);
//Display.setDisplayMode(findDisplayMode(sizeX, sizeY, Display.getDisplayMode().getBitsPerPixel()));
} else {
gameWindow = glfwCreateWindow(sizeX, sizeY, gameName, glfwGetPrimaryMonitor(), NULL);
//Display.setDisplayModeAndFullscreen(findDisplayMode(sizeX, sizeY, Display.getDisplayMode().getBitsPerPixel()));
}
//Display.setTitle(gameName);
//Display.create();
engineLogger.info("Starting LWJGL - OpenAL...");
//AL.create();
soundSystemContext = ALContext.create();
engineLogger.info("LWJGL - OpenAL successfully started !");
//Mouse.create();
//Keyboard.create();
glfwMakeContextCurrent(gameWindow);
GLContext.createFromCurrent();
initOpenGL();
init();
ByteBuffer[] shit = new ByteBuffer[2];
if (getIconPackage() == null) {
shit[0] = renderEngine.mountTexture("PNG", GameApplication.class.getResourceAsStream("icon16.png"));
shit[1] = renderEngine.mountTexture("PNG", GameApplication.class.getResourceAsStream("icon32.png"));
} else {
shit[0] = renderEngine.mountTexture("PNG", ClassLoader.getSystemResourceAsStream("./" + getIconPackage() + "/gameIcon16.png"));
shit[1] = renderEngine.mountTexture("PNG", ClassLoader.getSystemResourceAsStream("./" + getIconPackage() + "/gameIcon32.png"));
}
//Display.setIcon(shit); Will wait for next GLFW version
while (glfwWindowShouldClose(gameWindow) == GL11.GL_FALSE) {
curTime = getTime();
//Display.update();
gameTimer.updateTimer();
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
for (int j = 0; j < gameTimer.elapsedTicks; j++) {
update();
}
glfwSwapBuffers(gameWindow); //Swap buffers
render();
updateFPS();
prevTime = curTime;
glfwPollEvents(); //Equivalent to Display.update()
}
closeGame();
} catch (Exception e) {
onGameCrash(e);
}
}
EDIT : I forget to say it's crashing at initOpenGL which means to run loading function and intializing function for OpenGL, this also preloads the AssetsManager which by definition will inject textures as raw in memory.