private int loadShader(String file, int type) {
        System.out.println("Loading shader <" + file + ">");
        StringBuilder source = new StringBuilder();
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(file));
            String line = null;
            while ((line = reader.readLine()) != null)
                source.append(line).append("\n");
        } catch (IOException e) {
            e.printStackTrace();
            System.err.println("Error: Could not read shader file: " + file);
            System.exit(1);
        } finally {
            if (reader != null)
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
        }

        int shaderID = GL20.glCreateShader(type);
        GL20.glShaderSource(shaderID, source);
        GL20.glCompileShader(shaderID);
        if (GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
            System.err.println("Error: Could not comple shader");
            System.err.println(GL20.glGetShaderInfoLog(shaderID, 500));
            System.exit(1);
        }

        return shaderID;
    }