title: Qt OpenGL - Texture Transparency issue
body: <p>I'm currently trying to learn OpenGL, and I'm having trouble with texture transparency.</p>
  
  <p>I have 2 planes/rectangles that are textured, the first is closest to the camera, the second is further back, behind the first one. Both are textured with an image that has a background at 50% opacity.</p>
  
  <p>I should be able to see the texture of the second plane behind the first since the first is transparent to some degree - but I don't. The images I'm using do in fact appear on their own (can see them if I rotate the camera), and they have words on them (which I would expect to kind of bleed through the semi-transparent background of the image in front).</p>
  
  <p>Is there a way to correct this?
  Here is my initialization and paintGL methods (they are probably horribly optimized)</p>
  
  <pre><code>void oglWidget::initializeGL()
  {
      glEnable(GL_DEPTH_TEST);
      glEnable(GL_BLEND);
      glEnable(GL_CULL_FACE);
  
      qglClearColor(QColor(Qt::white));
  
      shaderProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/vertexShader.vsh");
      shaderProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/fragmentShader.fsh");
      shaderProgram.link();
  
      //    vertices[1] &lt;&lt; QVector3D(-xAmt, -1,  0) &lt;&lt; QVector3D( xAmt, -1,  0) &lt;&lt; QVector3D( xAmt,  1,  0) // Front
      //            &lt;&lt; QVector3D( xAmt, 1,  0) &lt;&lt; QVector3D(-xAmt,  1,  0) &lt;&lt; QVector3D(-xAmt, -1,  0);
  
      float xAmt = 16.00/9.00;
      vertices &lt;&lt; QVector3D(-xAmt, -1,  0) &lt;&lt; QVector3D( xAmt, -1,  0) &lt;&lt; QVector3D( xAmt,  1,  0) // Midground
               /*&lt;&lt; QVector3D( xAmt, 1,  0) &lt;&lt; QVector3D(-xAmt,  1,  0) &lt;&lt; QVector3D(-xAmt, -1,  0)*/
               &lt;&lt; QVector3D(-xAmt, -1,  -1) &lt;&lt; QVector3D( xAmt, -1,  -1) &lt;&lt; QVector3D( xAmt,  1,  -1) // Background
               &lt;&lt; QVector3D( xAmt, 1,  -1) &lt;&lt; QVector3D(-xAmt,  1,  -1) &lt;&lt; QVector3D(-xAmt, -1,  -1);
  
  
      textureCoordinates &lt;&lt; QVector2D(0, 0) &lt;&lt; QVector2D(1, 0) &lt;&lt; QVector2D(1, 1) // Front
                         &lt;&lt; QVector2D(1, 1) &lt;&lt; QVector2D(0, 1) &lt;&lt; QVector2D(0, 0)
                         &lt;&lt; QVector2D(0, 0) &lt;&lt; QVector2D(1, 0) &lt;&lt; QVector2D(1, 1) // Front
                         &lt;&lt; QVector2D(1, 1) &lt;&lt; QVector2D(0, 1) &lt;&lt; QVector2D(0, 0);
  }
  
  void oglWidget::paintGL()
  {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      QMatrix4x4 mMatrix;
      QMatrix4x4 vMatrix;
  
      QMatrix4x4 cameraTransformation;
      cameraTransformation.rotate(alpha, 0, 1, 0);
      cameraTransformation.rotate(beta, 1, 0, 0);
  
      QVector3D cameraPosition = cameraTransformation * QVector3D(0, 0, distance);
      QVector3D cameraUpDirection = cameraTransformation * QVector3D(0, 1, 0);
  
      vMatrix.lookAt(cameraPosition, QVector3D(0, 0, 0), cameraUpDirection);
      shaderProgram.bind();
      shaderProgram.setUniformValue("mvpMatrix", pMatrix * vMatrix * mMatrix);
  
  
      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
      glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  
      shaderProgram.setUniformValue("texture", 0);
      shaderProgram.setAttributeArray("vertex", vertices.constData());
      shaderProgram.enableAttributeArray("vertex");
      shaderProgram.setAttributeArray("textureCoordinate", textureCoordinates.constData());
      shaderProgram.enableAttributeArray("textureCoordinate");
      glGenTextures(0, &amp;texture);    glBindTexture(GL_TEXTURE_2D, texture);
  
      QImage tempTexture = QGLWidget::convertToGLFormat(QImage(ImgManager::getImg("/Textures/Editor/m.png")));
      glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, tempTexture.width(), tempTexture.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, tempTexture.bits() );
      glDrawArrays(GL_TRIANGLES, 0, vertices.size());
  
      shaderProgram.release();
  }
  </code></pre>