Hello!
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.
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;
}