title: glsl shader passing and rendering texture
body: <p>I'm trying to pass and use a texture to shader... but every time I try to use it in even the easiest way I get black box, sometimes white - depends on the texture I put him.. somehow....</p>
  
  <p>Here's code fragment witch should work ( i've removed my wrappers to make it easier):</p>
  
  <pre><code>fbo-&gt;bind();
  fbo-&gt;drawBuffer(0);
  fbo-&gt;setClearColor( 1.0, 1.0, 1.0, 1.0);
  fbo-&gt;cleanCurrentTexture();
  
  GLuint location;
  location = glGetUniformLocation( Program-&gt;getID(), "sampler");
  glActiveTexture( GL_TEXTURE0 );
  glBindTexture(GL_TEXTURE_2D, fbo2-&gt;getTexture(0) );
  glUniform1i(location, 0);
  Program-&gt;begin();
  glEnable(GL_TEXTURE_2D);
  
  glBegin(GL_QUADS);
      glVertex3f( -1.0f, -1.0f, 0.0f );
      glVertex3f( -1.0f, 1.0f, 0.0f );
      glVertex3f( 1.0f, 1.0f, 0.0f );
      glVertex3f( 1.0f, -1.0f, 0.0f );
  glEnd();
  
  Program-&gt;end();
  
  fbo-&gt;unbind();
  
  glColor3f(1.0,1.0,1.0);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  
  glEnable( GL_TEXTURE_2D );
  glBindTexture( GL_TEXTURE_2D, fbo-&gt;getTexture(0) );
      glBegin(GL_QUADS);
           glTexCoord2d( 0.0f, 0.0f);
          glVertex3f( -1.0f, -1.0f, 0.0f );
           glTexCoord2d( 0.0f, 1.0f);
          glVertex3f( -1.0f, 1.0f, 0.0f );
           glTexCoord2d( 1.0f, 1.0f);
          glVertex3f( 1.0f, 1.0f, 0.0f );
           glTexCoord2d( 1.0f, 0.0f);
          glVertex3f( 1.0f, -1.0f, 0.0f );
      glEnd();
  glDisable( GL_TEXTURE_2D);
  </code></pre>
  
  <p>Vertex shader:</p>
  
  <pre><code>#version 120
  
  void main()
  {
      gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
      gl_TexCoord[0] = gl_MultiTexCoord0;
  }
  </code></pre>
  
  <p>Fragment shader:</p>
  
  <pre><code>#version 120
  
  uniform sampler2D sampler;
  
  void main()
  {   
      gl_FragColor = texture2D(sampler, gl_TexCoord[0].xy);
  }
  </code></pre>
  
  <p>Ofcourse the texture I'm trying to bind exists and its complete. Here are it's parameters:</p>
  
  <pre><code>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
  glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
  </code></pre>