title: Can't copy from GPU to CPU (OpenGL)
body: <p>Here is my texture class:</p>
  
  <pre><code>struct GPUAllocation {
      uint ID,VectorType,DataType,Width,Height,Format,IntFormat;
      //ID is the output from glGen* and Format is the format of the texture and IntFormat
      //is the Internal Format of this texture. (Width and height and too obvious)
      //DataType is like GL_FLOAT...
      bool isFinalized;
      GPUAllocation(uint vectorType,uint dataType,uint width,uint height);
      void SetSlot(int n);
      void Finalize();
      ~GPUAllocation();
  };
  </code></pre>
  
  <p>Code to copy from this texture to RAM:</p>
  
  <pre><code>void memcpy(GPUAllocation src,void* dst) {
      glBindTexture(GL_TEXTURE_2D,src.ID); //ID is the output from glGen*
      glTexSubImage2D(GL_TEXTURE_2D,0,0,0,src.Width,src.Height,src.Format,src.DataType,dst);
  }
  </code></pre>
  
  <p>The code that runs this function is:</p>
  
  <pre><code>GPUAllocation gpu_alloc(PCPU_Vector1,PCPU_Float,4096,4096); //I generate Format and IntFormat here.
  //The generated format is correct because when I copied from GPU to CPU I didn't got any error
  float *cpu_alloc=new float[4096*4096];
  memcpy(gpu_alloc,cpu_alloc); //The error occurred here!
  </code></pre>
  
  <p>The error that occurred was <code>1281</code>.</p>
  
  <hr>
  
  <p>EDIT:
  I found when I copying from GPU to CPU and then CPU to GPU I got that error. If I first copy from GPU to CPU I didn't got any error.
  The function that copies from CPU to GPU is:</p>
  
  <pre><code>void memcpy(void* src,GPUAllocation dst) {
      glBindTexture(GL_TEXTURE_2D,dst.ID);
      glGetTexImage(GL_TEXTURE_2D,0,dst.Format,dst.DataType,src);
  }
  </code></pre>