Re: [Interest] OpenGL weirdness
On Friday 25 Jul 2014 06:20:35 Yves Bailly wrote: On 24/07/2014 20:33, Till Oliver Knoll wrote: Am 24.07.2014 um 14:13 schrieb Yves Bailly yves.bai...@verosoftware.com: [...] fmt.setVersion(2, 1); ...getGetString(GL_VERSION) gives 4.4.0 (unexpected), and no triangle displayed. As already mentioned in a previous reply: maybe a bit unexpected, but totally fine, because you get a Compatibility profile. With simply requesting the profile, without giving a version: Doesn't make sense really: profiles are only introduced on OpenGL 3.2 and above :) Any idea about what's going on? I strongly assume that you're not using any fixed pipeline functions such as glVertex etc. ;) so my best bet would be your shader code: did you copy/paste from some older OpenGL (ES) 2 shaders? Thanks all for your answers, finally I found where the problem was. In short, here's what happened. This was a piece of code which used to work fine with Qt 5.2.1, a few months ago. Indeed no fixed pipeline, good #version 330 shaders, and so on. Yesterday I just rebuild it but using Qt 5.3.1, to see it was no more working. Why? In the meantime, two things had change: the Qt version, *and* I got a new workstation, with a new GPU, a new OS, a new driver. And this is where the problem lies. In my code, I was *not* using any VAO. It seems the old driver was always giving me a compatibility profile - hence no need for VAOs. But the new drivers gives me a real core profile, in which VAOs are mandatory. No VAO, no display... :-) Just adding the needed VAOs made the things work again. Ah just one of a gazillion ways you can see nothing with OpenGL. My recent hilarious cause of not seeing anything was to render a quad. Shaders were fine, all buffers and VAOs set correctly, all uniforms looked fine... almost. It turned out my modelview matrix was rendering exactly edge on resulting in zero pixels being rasterised. Isn't graphics fun ;) Sean -- Dr Sean Harmer | sean.har...@kdab.com | Managing Director UK Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] OpenGL weirdness
On 24/07/2014 20:33, Till Oliver Knoll wrote: Am 24.07.2014 um 14:13 schrieb Yves Bailly yves.bai...@verosoftware.com: [...] fmt.setVersion(2, 1); ...getGetString(GL_VERSION) gives 4.4.0 (unexpected), and no triangle displayed. As already mentioned in a previous reply: maybe a bit unexpected, but totally fine, because you get a Compatibility profile. With simply requesting the profile, without giving a version: Doesn't make sense really: profiles are only introduced on OpenGL 3.2 and above :) Any idea about what's going on? I strongly assume that you're not using any fixed pipeline functions such as glVertex etc. ;) so my best bet would be your shader code: did you copy/paste from some older OpenGL (ES) 2 shaders? Thanks all for your answers, finally I found where the problem was. In short, here's what happened. This was a piece of code which used to work fine with Qt 5.2.1, a few months ago. Indeed no fixed pipeline, good #version 330 shaders, and so on. Yesterday I just rebuild it but using Qt 5.3.1, to see it was no more working. Why? In the meantime, two things had change: the Qt version, *and* I got a new workstation, with a new GPU, a new OS, a new driver. And this is where the problem lies. In my code, I was *not* using any VAO. It seems the old driver was always giving me a compatibility profile - hence no need for VAOs. But the new drivers gives me a real core profile, in which VAOs are mandatory. No VAO, no display... :-) Just adding the needed VAOs made the things work again. Thanks all for your help. -- /- Yves Bailly - Software developer -\ \- Sescoi RD - http://www.sescoi.fr -/ The possible is done. The impossible is being done. For miracles, thanks to allow a little delay. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] OpenGL weirdness
Greetings all, I'm trying to build a very basic OpenGL program, just displaying a red triangle. Context: - Windows 7 64bits - Qt 5.3.1 (tested with the official MinGW build and a Visual 2012 build) - I will need OpenGL 3.3 core and have to use GLEW - using QGLWidget, overriding the usual initializeGL() and paintGL() When I'm creating my widget like this: QGLFormat fmt( QGL::DoubleBuffer bitor // enables double-buffering QGL::DepthBuffer bitor// enables support for depth buffer QGL::AlphaChannel bitor // enables support for alpha-blending QGL::StencilBuffer bitor // enables support for stencil buffer QGL::DirectRendering // enables direct rendering to display ); fmt.setStencilBufferSize(8); QGLFormat::setDefaultFormat(fmt); Gl_Widget glw; glw.show(); ...then it works fine, I see my triangle. glGetString(GL_VERSION) gives 4.4.0. But if I add an explicit request for the GL version: fmt.setVersion(4, 4); fmt.setProfile(QGLFormat::CoreProfile); ...then I no longer see my triangle, however glGetString(GL_VERSION) still gives 4.4.0. If I try using some other version: fmt.setVersion(3, 3); fmt.setProfile(QGLFormat::CoreProfile); ...getGetString(GL_VERSION) gives 3.3.0 (as expected), but no triangle displayed. With: fmt.setVersion(2, 1); ...getGetString(GL_VERSION) gives 4.4.0 (unexpected), and no triangle displayed. With simply requesting the profile, without giving a version: fmt.setProfile(QGLFormat::CoreProfile); ...getGetString(GL_VERSION) gives 4.4.0 and my triangle is displayed. Any idea about what's going on? The same thing occures on both MinGW (32bits) and Visual C++ 2012 (64bits). I'm investigating this thing because a program that used to work well with Qt 5.2.1 no longer works with Qt 5.3.1. Any hint highly welcome. -- /- Yves Bailly - Software developer -\ \- Sescoi RD - http://www.sescoi.fr -/ The possible is done. The impossible is being done. For miracles, thanks to allow a little delay. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] OpenGL weirdness
Hello, Il 24/07/2014 14:13, Yves Bailly ha scritto: Any idea about what's going on? The same thing occures on both MinGW (32bits) and Visual C++ 2012 (64bits). Can you also dump the context profile? Maybe unless you're requesting both a version = 3.2 *and* a Core profile, then you're getting a Compatibility profile. Regards, -- Join us Oct 6-8 at BCC Berlin for Qt Developer Days 2014! Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Software Engineer KDAB (UK) Ltd., a KDAB Group company Tel. UK +44-1738-450410, Sweden (HQ) +46-563-540090 KDAB - Qt Experts - Platform-independent software solutions smime.p7s Description: Firma crittografica S/MIME ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] OpenGL weirdness
Hello, Yes, check the profile too. Additionally, starting from 5.3, we have a useful example in qtbase/examples/opengl/contextinfo that can be used to check what kind of context is returned for a given version, profile and options combination. Gl_Widget glw; glw.show(); Here you are asking for OpenGL 2.0. You get a 4.4 compatibility profile context. This is just fine. The driver is free to give you 2.0, 2.1, or a compatibility profile of 3.2, 3.3, 4.x. fmt.setVersion(4, 4); fmt.setProfile(QGLFormat::CoreProfile); Here you are asking for 4.4 core profile and that's exactly what you are getting. Are the app's OpenGL shaders and calls prepared to handle core profile? fmt.setVersion(3, 3); fmt.setProfile(QGLFormat::CoreProfile); Similarly to the previous, you get 3.3 core. fmt.setVersion(2, 1); Again, it gives you 4.4 compatibility. fmt.setProfile(QGLFormat::CoreProfile); This is again 4.4 compatibility (not core) since you are requesting 2.0 core which does not make sense so the profile is ignored. Best regards, Laszlo From: interest-bounces+laszlo.agocs=digia@qt-project.org [interest-bounces+laszlo.agocs=digia@qt-project.org] on behalf of Giuseppe D'Angelo [giuseppe.dang...@kdab.com] Sent: Thursday, July 24, 2014 2:49 PM To: interest@qt-project.org Subject: Re: [Interest] OpenGL weirdness Hello, Il 24/07/2014 14:13, Yves Bailly ha scritto: Any idea about what's going on? The same thing occures on both MinGW (32bits) and Visual C++ 2012 (64bits). Can you also dump the context profile? Maybe unless you're requesting both a version = 3.2 *and* a Core profile, then you're getting a Compatibility profile. Regards, -- Join us Oct 6-8 at BCC Berlin for Qt Developer Days 2014! Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Software Engineer KDAB (UK) Ltd., a KDAB Group company Tel. UK +44-1738-450410, Sweden (HQ) +46-563-540090 KDAB - Qt Experts - Platform-independent software solutions ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] OpenGL weirdness
Am 24.07.2014 um 14:13 schrieb Yves Bailly yves.bai...@verosoftware.com: [Whenever a Core Profile is explicitly requested rendering stops workin] If I try using some other version: fmt.setVersion(3, 3); fmt.setProfile(QGLFormat::CoreProfile); ...getGetString(GL_VERSION) gives 3.3.0 (as expected), Not directly related to the actual problem, but just to add: in my understanding the actual OpenGL driver is free to choose a higher API version (e.g. 4.4), even when you explicitly request an older one (e.g. 3.3) - as long as the returned context is backwards-compatible, that is! I am not sure whether that is the case here (all 3.3 shaders and GL code would run without modification in 4.4), but in general that is so. So the fact that you really received a 3.3 context when asking for one from a 4.4 capable driver is possible and maybe even likely, but not necessarily to be expected. IIRC on OS X 10.9 you always get a 4.1 context, even when asking for a 3.2 context (on hardware that supports it). but no triangle displayed. Probably again because you are getting a Core Profile. With: fmt.setVersion(2, 1); ...getGetString(GL_VERSION) gives 4.4.0 (unexpected), and no triangle displayed. As already mentioned in a previous reply: maybe a bit unexpected, but totally fine, because you get a Compatibility profile. With simply requesting the profile, without giving a version: Doesn't make sense really: profiles are only introduced on OpenGL 3.2 and above :) Any idea about what's going on? I strongly assume that you're not using any fixed pipeline functions such as glVertex etc. ;) so my best bet would be your shader code: did you copy/paste from some older OpenGL (ES) 2 shaders? Check the GL error state then and when and especially the shader compile/link logs (return values)! Cheers, Oliver ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest