title: glGetUniformLocation and glUseProgram give the error invalid operation (1282). Can anyone help resolve the issue?
body: <p>Right now I am building a 3d game engine to make it easier to program 3d games. Everything has been working well up until I got a new computer. On the old one which was a windows vista PC it worked fine, now I am using a windows 8 PC and the methods that are used to get the uniform locations for my shaders are giving the error invalid operation (1282). </p>
  
  <pre><code>org.lwjgl.opengl.OpenGLException: Invalid operation (1282)
      at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
      at org.lwjgl.opengl.GL20.glGetUniformLocation(GL20.java:664)
      at lib.ogl.graphicEffects.shaders.shaderProgram.getUniformLocation(shaderProgram.java:50)
      at lib.ogl.graphicEffects.shaders.StaticShader.getAllUniformLocations(StaticShader.java:45)
      at lib.ogl.graphicEffects.shaders.shaderProgram.&lt;init&gt;(shaderProgram.java:44)
      at lib.ogl.graphicEffects.shaders.StaticShader.&lt;init&gt;(StaticShader.java:32)
      at lib.org.Engine.engine.run(engine.java:72)
      at lib.org.Game.MainClass.main(MainClass.java:37)
  </code></pre>
  
  <p>I think that it is a problem with linking the shader but I do not know how to test that or how to fix it.</p>
  
  <p>the code looks like this:</p>
  
  <pre><code>public shaderProgram(String vertexFile, String fragmentFile){
          vertexShaderID = loadShader(vertexFile, GL_VERTEX_SHADER);
          fragmentShaderID = loadShader(fragmentFile, GL_FRAGMENT_SHADER);
          programID = glCreateProgram();
          glAttachShader(programID, vertexShaderID);
          glAttachShader(programID, fragmentShaderID);
          bindAttributes();
          glLinkProgram(programID);
  if(glGetProgrami(programID, GL_LINK_STATUS)==GL_FALSE){
      Debug.Errorlog("failure in linking the shader program");
      System.exit(-1);
  }
  glValidateProgram(programID);
  if(glGetProgrami(programID, GL_VALIDATE_STATUS)==GL_FALSE){
      Debug.Errorlog("failure in validating the shader program");
      System.exit(-1);
  }
          getAllUniformLocations();
      }
  </code></pre>
  
  <p>The loadShader class correctly loads the shader.
  The problem occurs when the program attempts to link the shaders I will add in the code for loading the shaders, but it does not appear to be the problem:</p>
  
  <pre><code>*public static int loadShader(String file, int type){
          StringBuilder shaderSource = new StringBuilder();
          try{
              BufferedReader reader = new BufferedReader (new FileReader(file));
              String line;
              while((line = reader.readLine())!= null){
                  shaderSource.append(line).append("\n");
              }
              reader.close();
          }catch(Exception e){
              Debug.log("could not load the shader file : " + file);
          }
          int shaderID = glCreateShader(type);
          glShaderSource(shaderID, shaderSource);
          glCompileShader(shaderID);
          if(glGetShaderi(shaderID,GL_COMPILE_STATUS)==GL_FALSE){
              glGetShaderInfoLog(shaderID,500);//TODO DEBUG.log?
              Debug.Errorlog("Could not compile the shader");
              System.exit(-1);
          }
          return shaderID;
      }
  </code></pre>
  
  <p>The getAllUniformLocations methods looks like this:</p>
  
  <pre><code>protected void getAllUniformLocations() {
      try{
          location_transformationMatrix = super.getUniformLocation("transformationMatrix");
          location_projectionMatrix = super.getUniformLocation("projectionMatrix");
          location_viewMatrix = super.getUniformLocation("viewMatrix");
          location_shineDamper = super.getUniformLocation("shineDamper");
          location_reflectivity = super.getUniformLocation("reflectivity");
          location_skyColor = super.getUniformLocation("skyColor");
  
          location_lightPosition = new int[MAX_LIGHTS];
          location_lightcolor = new int[MAX_LIGHTS];
          location_attenuation = new int [MAX_LIGHTS];
          for(int x = 0; x &lt; MAX_LIGHTS; x ++){
              location_lightPosition[x] = super.getUniformLocation("lightPosition["+x+"]");
              location_lightcolor[x] = super.getUniformLocation("lightColor["+x+"]");
              location_attenuation[x] = super.getUniformLocation("attenuation["+x+"]");
          }
      }catch(Exception e){
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Every time it attempts to load the first uniform, it catches the error and prints the stacktrace that I presented above.</p>
  
  <p>Could it be a problem that my old graphics card overlooked? </p>
  
  <p>It turns out the real problem is that after compiling correctly, the shaders fail to link to the program!</p>