The title isn't really the question, but it's the best I could do to summarize my problem.

I have a Qt program with a child of QGLWidget and everything is working just fine with OpenGL 3.3. The one problem I'm getting is that all the meshes I create are transparent even though their alpha values are set to 1 (remembering that OpenGL works on 0-1, not 0-255). I've played around with the OpenGL commands but can't get it to work. This all sounds and feels like its more of an OpenGL problem than a Qt problem, but I'm not being able to get much help from the people at the opengl.org forums and so, thinking that maybe I was missing something Qt-related, I returned to the documentation and found the following.

In the QGLWidget docs, there's a little example of how a child should look like, and it contains:
Qt Code:
  1. glEnable(GL_DEPTH_TEST);
To copy to clipboard, switch view to plain text mode 
However, the QGLFormat::depth() docs say that depth-testing is active by default. So why does QGLWidget enable it?

In any case, here is my code attempting to set these things up.
Qt Code:
  1. //fragment shader
  2. #version 330
  3. precision highp float;
  4.  
  5. uniform vec3 EyeAxis = vec3(0.0,0.0,1.0);
  6. uniform mat4 Modelview;
  7. uniform mat4 Projection;
  8. in vec3 ex_Color;
  9. in vec4 ex_Normal;
  10. out vec4 FragColor;
  11.  
  12. void main(void)
  13. {
  14. vec4 Normal = Projection*Modelview*ex_Normal;
  15. vec4 Eye = vec4(EyeAxis,1.0);
  16. float c = abs(dot(normalize(Eye.xyz),normalize(Normal.xyz)));
  17. FragColor = vec4((0.2+0.8*c)*ex_Color,1.0);
  18. }
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. void MyNGLWidget::Initialize()
  2. {
  3. //only called after drawing data (coordinates, colors, normals, etc) have been loaded
  4. GenBuffers();
  5. GenShaders();
  6. glEnable(GL_BLEND);
  7. glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  8. glEnable(GL_DEPTH_TEST);
  9.  
  10. Initialized = true;
  11. updateGL();
  12. }
  13. void MyNGLWidget::initializeGL()
  14. {
  15. glewInit();
  16. format().setDepth(true); //even though its true by default
  17. format().setDepthBufferSize(32); //even though Qt tends to reject this value and stick to 24X8
  18. }
To copy to clipboard, switch view to plain text mode 

Any hints and tips?