[Interest] QML / OpenGL / scene graph problem.
Hi and help! I have a problem here. Unfortunately I am not very experienced with OpenGL and need a hint in which direction I have to look to fix the following problem. I took the HelloGL code from the examples and wanted to make it into a QML widget. I cannot my experiments are a total failure, but unfortunately they are far from a total success also. https://imageshack.com/i/59c6eip https://imageshack.com/i/jmg97op The pics above show my problem. The old TT logo is recognizable, but the parts do not 'fit'. Also there is something wrong with the ring. This is strange, because I did not change anything in the way the mesh is calculated. It is 100% as found in the HelloGL example. The only thing I did was to put the OpenGL code into a paint() function. Similar to the one in the 'OpenGL Under QML example'. The paint function is plenty of copy/paste trial/error. And it certainly will change as soon as I get a better understandig about the scene graph stuff. But until then... does anyone see why the geometry of the TT logo is distorted? Guido void Squircle::paint() { glViewport(0, 0, window()-width(), window()-height()); glMatrixMode(GL_PROJECTION); glLoadIdentity(); #ifdef QT_OPENGL_ES_1 glOrthof(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0); #else glOrtho(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0); #endif glMatrixMode(GL_MODELVIEW); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glShadeModel(GL_SMOOTH); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_MULTISAMPLE); static GLfloat lightPosition[4] = { 0.5, 5.0, 7.0, 1.0 }; glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); delete m_fbo; m_fbo = 0; int width = this-width(); int height = this-height(); if (width height){ m_fbo = new QOpenGLFramebufferObject(width, height); } if (m_fbo){ QOpenGLFunctions glFunctions(QOpenGLContext::currentContext()); glFunctions.glUseProgram(0); QObject::connect(QOpenGLContext::currentContext(), SIGNAL(aboutToBeDestroyed()), this, SLOT(cleanup()), Qt::DirectConnection); m_fbo-bind(); glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0, 0.0, -10.0); glRotatef(mXRot / 16.0, 1.0, 0.0, 0.0); glRotatef(mYRot / 16.0, 0.0, 1.0, 0.0); glRotatef(mZRot / 16.0, 0.0, 0.0, 1.0); mMesh-setColor(green); mMesh-draw(); m_fbo-release(); m_fbo-blitFramebuffer(this-window()-renderTarget(), m_fbo); } } ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] Get the username:password part of a HTTP request from QTcpSocket
Hi I have a HTTP-Server based on QTcpServer. Do you have an idea how I could get the authority part of the HTTP request? (https://en.wikipedia.org/wiki/URI_scheme#Generic_syntax) A request might look like this: http://username:password@127.0.0.1:8462http://127.0.0.1:8462/ /method?key=value From the incomming QTcpSocket I can only get the IP, the port number and the data (which includes the query string for HTTP but not the authentication part). How can I get the rest of the request? Thanks ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QML / OpenGL / scene graph problem.
Hi, On 01/12/2013 16:00, Guido Seifert wrote: Hi and help! I have a problem here. Unfortunately I am not very experienced with OpenGL and need a hint in which direction I have to look to fix the following problem. I took the HelloGL code from the examples and wanted to make it into a QML widget. I cannot my experiments are a total failure, but unfortunately they are far from a total success also. https://imageshack.com/i/59c6eip https://imageshack.com/i/jmg97op Those images are fairly typical of artefacts you get when depth testing/writing is not enabled. Be aware that the final phase of Qt Quick 2 rendering is typically to render transparent objects using alpha blending. To do this QQ2 renders these items from back to front with blending enabled to get the correct results. However, the important part of this is that the depth buffer is disabled for writes. This means that when you get to render your object, it is quite likely that depth writes are still disabled. I see from your code that you are enabling depth testing. However, without any sane values in the depth buffer this won't work. To enable depth writes, try calling glDepthMask(true) before you render any geometry. Also please note that there is a new helper function to return the OpenGL state to it's default (i.e. to undo the changes that the QQ2 renderer makes). The function is: http://doc-snapshot.qt-project.org/qt5-release/qquickwindow.html#resetOpenGLState Amongst other things, this function also enabled depth writes as suggested above. Whether you choose to use this helper or to only alter the state that you need is your choice. Hope this helps, Sean -- Dr Sean Harmer | sean.har...@kdab.com | Senior Software Engineer 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] QML / OpenGL / scene graph problem.
Hope this helps, Yep, thank you. Not the exact solution, but close enough to give me enough information so I could successfully narrow my search. This line was missing: m_fbo-setAttachment(QOpenGLFramebufferObject::Depth); QOpenGLFramebufferObject::NoAttachment 0 No attachment is added to the framebuffer object. Note that the OpenGL depth and stencil tests won't work when rendering to a framebuffer object without any depth or stencil buffers. This is the default value. QOpenGLFramebufferObject::Depth 2 A depth buffer is attached to the framebuffer object. Now the code works and I can start to get it right. :-) Guido ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Get the username:password part of a HTTP request from QTcpSocket
On domingo, 1 de dezembro de 2013 17:11:20, Lucas Betschart wrote: Hi I have a HTTP-Server based on QTcpServer. Do you have an idea how I could get the authority part of the HTTP request? (https://en.wikipedia.org/wiki/URI_scheme#Generic_syntax) A request might look like this: http://username:password@127.0.0.1:8462http://127.0.0.1:8462/ /method?key=value From the incomming QTcpSocket I can only get the IP, the port number and the data (which includes the query string for HTTP but not the authentication part). How can I get the rest of the request? They're part of the HTTP headers that you received. Take a look at RFC 2616. You're looking for the Host and Authorization headers. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center signature.asc Description: This is a digitally signed message part. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Get the username:password part of a HTTP request from QTcpSocket
Hi, On Sunday 01 December 2013, Lucas Betschart wrote: I have a HTTP-Server based on QTcpServer. Do you have an idea how I could get the authority part of the HTTP request? (https://en.wikipedia.org/wiki/URI_scheme#Generic_syntax) A request might look like this: http://username:password@127.0.0.1:8462http://127.0.0.1:8462/ /method?key=value If you've got the HTTP-Server class from the outside it should provide you with authority information. From the incomming QTcpSocket I can only get the IP, the port number and the data (which includes the query string for HTTP but not the authentication part). How can I get the rest of the request? On the other hand if you are trying to implement HTTP with only limited knowledge about the protocol: I strongly suggest you look for alternative options - HTTP is trickier than it looks at first. To name just a few pitfalls that I have encountered with this: * you have to support 2 radically different protocols: HTTP 0.9 and 1.x * the latter has 2 dialects: HTTP 1.0 and 1.1 which differ in some key details * there may be a radically different 3rd protocol soon: HTTP 2.0 * in HTTP 1.1 clients can state (POST) requests outright or they can ask nicely first - the 100-continue feature * some clients use the streaming feature (chunked encoding) without reason or rhyme (Microsoft's SOAP implementations are particularly bad) In short: if you do not have the need to access every bit directly use an existing server implementation and an easier way to communicate with it. For example Apache has modules for the FCGI and SCGI protocols. In this case Apache handles the complexities of HTTP while you just have to handle a significantly simpler protocol. Konrad signature.asc Description: This is a digitally signed message part. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Get the username:password part of a HTTP request from QTcpSocket
Hi Konrad / Lucas -Original Message- Sent: Monday, 2 December 2013 7:27 AM ... In short: if you do not have the need to access every bit directly use an existing server implementation and an easier way to communicate with it. For example Apache has modules for the FCGI and SCGI protocols. In this case Apache handles the complexities of HTTP while you just have to handle a significantly simpler protocol. Konrad Or keep your existing QTCPServer based code. Then use Apache as the front-end, and proxy to your backend server. Very straight-forward. Regards, Tony ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Get the username:password part of a HTTP request from QTcpSocket
Hi, On Monday, Monday 02 December 2013 at 01:49, Tony Rietwyk wrote: In short: if you do not have the need to access every bit directly use an existing server implementation and an easier way to communicate with it. For example Apache has modules for the FCGI and SCGI protocols. In this case Apache handles the complexities of HTTP while you just have to handle a significantly simpler protocol. Or keep your existing QTCPServer based code. Then use Apache as the front-end, and proxy to your backend server. Very straight-forward. I have never tried such a setup, but it sounds like a great idea. Upon reading the mod_proxy docu a bit I would recommend restricting the configuration as far as possible, e.g. by forcing Apache to use HTTP 1.0 you avoid the two most troublesome features (100-continue and chunked encoding). Konrad signature.asc Description: This is a digitally signed message part. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest