protected int compileShader(int type, String source) throws LWJGLException {
        int shader = GL20.glCreateShader(type);
        if (shader == 0)
            throw new LWJGLException("could not create shader object; check ShaderProgram.isSupported()");
        GL20.glShaderSource(shader, source);
        GL20.glCompileShader(shader);

        int comp = GL20.glGetShaderi(shader, GL20.GL_COMPILE_STATUS);
        int len = GL20.glGetShaderi(shader, GL20.GL_INFO_LOG_LENGTH);
        String t = shaderTypeString(type);
        String err = GL20.glGetShaderInfoLog(shader, len);
        if (err != null && err.length() != 0)
            log += t + " compile log:\n" + err + "\n";
        if (comp == GL11.GL_FALSE)
            throw new LWJGLException(log.length()!=0 ? log : "Could not compile "+shaderTypeString(type));
        return shader;
    }