LWJGLs window closed but javaw.exe still running

Hello! :slight_smile:

I just started learning using shaders with LWJGL and encountered a small problem. The program works fine, that is not the problem. But after exiting through clicking on the closing button of the window the process is still running. After like 10 seconds it stops too. But why does it last that long. It doesn’t if I don’t do these two lines:

		vertShader = createShader("shaders/rgb.vert",GL20.GL_VERTEX_SHADER);
		fragShader = createShader("shaders/simple.frag",GL20.GL_FRAGMENT_SHADER);

Is this a normal process or is there something I might have forgotten. Is it possible to fix this and why does it occur?
I would be glad if someone had an answer to it. :slight_smile:

EDIT:
createShader is the following method:

private int createShader(String path, int shaderType) {
		int shader = 0;
		
		FileReader reader = new FileReader();
		String program = reader.readFile(path);
		
		shader = GL20.glCreateShader(shaderType);
		if(shader == 0)
			return 0;
		GL20.glShaderSource(shader, program);
		GL20.glCompileShader(shader);
		 
		if (GL20.glGetShader(shader, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE)
		throw new RuntimeException("Error creating shader: " + GL20.glGetShaderInfoLog(shader,GL20.GL_INFO_LOG_LENGTH));
		 
		return shader;
	}

do you call Display.Destroy()?

Don’t think so… wait, I’ll take a look. :wink:

going down the stairs to eclipse
…
tap,tap,tap…
…
oh!
… tap, tap, tap…

No, I really didn’t do this! And it seems that exactly this was the problem, because now it works fine. I often forget those things…
Thanks for your help! :slight_smile: carving your name into medal

But why exactly does it behave like that? :open_mouth:

calling Display.destroy() tells lwjgl to start cleaning up. I guess when you exit without calling Display.destroy it’s left to the system to figure out what needs to be cleaned up.

When using JFrames you will notice that you have to call the show() method. Many programs run in the background without a GUI or without showing a GUI. Think of windows minimized. If you call exit or some other similar function, it does not necessarily mean, “close everything and release resources” It could mean, close GUI. So most programs have a cleanUp method or something that will be called when the app completely ends. That is what Display.distroy() does. You also should handle any auto saving or something before you call that.

Thanks for your advice. :slight_smile: You helped me a lot! Both of you.