-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.2.1, 5.3.0 Beta1
-
None
-
QtCreator 3.0.1, VS2013, Qt 5.2.1 and 5.3.0 Beta, ANGLE and OpenGL-Desktop builds, Windows 8.1
Steps to reproduce:
1) Open the example project "OpenGL Window Example" in QtCreator
2.a) Add a z-component to the vertices:
GLfloat vertices[] =
;
2.b) change the "2" to a "3" here:
glVertexAttribPointer(m_posAttr, 3, GL_FLOAT, GL_FALSE, 0, vertices);
2.c) add 'glEnable(GL_DEPTH_TEST);' in TriangleWindow::render()
and
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
2.d) at the end of render(), add:
float depth = -5.0f; // random value to see if it's changed
glReadPixels(320, 240, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
qDebug() << "Depth: " << depth;
Expected behaviour (console output):
Depth: 0.950951
However, what happens is the following:
Qt 5.2.1 MSVC2012 64bit (ANGLE): Depth: -5
Qt 5.2.1 MSVC2012 64bit (OpenGL): Depth: 0.950951
Qt 5.2.1 MingW 32bit: Depth: 0.950951
Qt 5.3 beta MSVC2013 64bit (ANGLE): Depth: -5
I tried several things, none of which helped:
a) adding
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glClearDepthf(1.0f);
in various combinations in various places
b) in main(), adding
format.setDepthBufferSize(24); // I also tried 16, 32
c) glGetIntegerv(GL_DEPTH_BITS, &dbits); always returns 24
d)
glGetError(); // clear the error value
glReadPixels(320, 240, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
GLenum err = glGetError();
qDebug() << "Err: " << err;
Outputs '1282' for the cases that don't work, '0' otherwise.
I guess this is a serious bug?