Andy Shaw

Qt Commercial Support Weekly #4: Mixing OpenGL and QPainter + Qt 4.5.x with Sun Studio 12

11/21/2011 3:05 PM  | Posted by: Andy Shaw
 

As a fair few may already know, it is possible to easily mix painting with OpenGL and QPainter with the help of QPainter::beginNativePainting() and QPainter::endNativePainting().  This enables you to do something like:

 

painter->beginNativePainting();

// opengl painting calls here

painter->endNativePainting();

painter->drawText(50, 50, "This is a test");

 

 

It will render the text after the OpenGL has been rendered.  For the most part this will work fine and will not cause any problems.  However, one thing to watch out for is that if you change any of the GL states after the beginNativePainting() call then this can have an effect on the Qt rendering.  One example is the GL_DEPTH_TEST state. If this is enabled after the beginNativePainting(), then it will cause the text not to be drawn.  This is because Qt does not account for any potential state changes that could have occurred.  Therefore, in order to be sure that it has no adverse effect on the Qt rendering, you need to reset the GL states to be back to what they are.  So you would have something like:

 

 

painter->beginNativePainting();

glEnable(GL_DEPTH_TEST);

// opengl painting calls here

glDisable(GL_DEPTH_TEST);

painter->endNativePainting();

painter->drawText(50, 50, "This is a test");

 

 

This will allow you to have the depth testing in your OpenGL without having it impact the painting done by the QPainter.  There are some other states to watch out for which are covered in the documentation for QPainter::beginNativePainting() at http://doc.qt.nokia.com/qpainter.html#beginNativePainting.

 

Now, to show that we still have love for those Unix platforms out there we recently heard of a build issue in support with using Sun Studio 12 (CC 5.10) with Qt 4.5.x.  Although CC 5.10 is not actually a supported version for Qt 4.5.x and we had the means to do so, we investigated the issue as we want to provide a good service where ever possible for customers.  I am happy to report that we have been able to fix the build issue that was reported, so if you are using Qt 4.5.x with Solaris and would like to get hold of the patch, then please submit a support request via the customer portal and we can make it available to you.  This doesn't mean we can provide official support for Sun Studio 12 with Qt 4.5.x, but from what we can see it is working pretty fine so every little bit helps.

 

Finally, next week, four of the support team members will be in San Francisco for Qt Developer Days 2011, so if you are around there then feel free to pop by. They will be there all days and they are ready to help you out or just to have a chat if you want to say hi.

19 

Comments:

Luck | 12/5/2011 2:26 PM
Artecils like this just make me want to visit your website even more.

tbzbmndoli | 12/5/2011 8:42 PM
fUFSxT lirdnlksabir

john dalton | 12/22/2011 11:27 PM
Can you use a beginNativePainting - endNativepainting code section to use opengl calls to paint directly into a QImage?

Andy Shaw | 12/29/2011 1:20 PM
john: I am afraid not, but you might want to consider using QGLFrameBufferObject to be able to draw something you can then convert to a QImage easily afterwards.

Aspen | 1/28/2012 6:36 AM
Please teach the rest of these internet hooligans how to write and resarech!

jbomtzcnojx | 1/28/2012 2:58 PM
1YORiL vhbwslguxyzo

tralliboll | 1/30/2012 4:51 AM
I see where you’re coming from, you want the best for your baby so to speak, but from my point of view it feels like you are just nitpicking little details. It’s not a great commercial, but I have to say it’s 100% better than most of the crap that gets shown on basic cable. (Head on, apply directly to the forehead!, etc) In fact, I had no interest in this type of software, and even though the script was a tad cringeworthy, in general the commercial did get me interested enough to actually think about whether I would use voice recognition if I had it and how it might help me.Looks like some really great software anyway. car insurance online

tralliboll | 1/30/2012 4:52 AM
I see where you’re coming from, you want the best for your baby so to speak, but from my point of view it feels like you are just nitpicking little details. It’s not a great commercial, but I have to say it’s 100% better than most of the crap that gets shown on basic cable. (Head on, apply directly to the forehead!, etc) In fact, I had no interest in this type of software, and even though the script was a tad cringeworthy, in general the commercial did get me interested enough to actually think about whether I would use voice recognition if I had it and how it might help me.Looks like some really great software anyway. car insurance online

adammaynard | 2/13/2012 8:26 AM
free car insurance quotes 8440 health insurance quotes lkmf

abx3xlax | 2/15/2012 4:34 AM
car insurance rates gzafd cheap auto insurance 79446

beyourfriend | 2/18/2012 5:03 AM
LOL! oh my this commercial was so inaccurate. theres no way he would turn her down. i know thats the whole point of it, but still. its funny tramadol life insurance policy

mnissinen | 2/22/2012 6:29 AM
Thanks Alexandra. I can see myself getting a lot of use out of this sweater! Bonus points that it's handmade by Nanny and passed down in the family. xo tramadol auto insurance quote

Alexandru | 2/23/2012 7:39 AM
Thank you for your post Marilyn and for carnig for the animals pulled from puppy mills. We hope that anyone who has first hand experience with this issue will step forward and take action by contacting the members of the Agricultural Committee as well as their own state legislators.

lbqlwjocp | 2/24/2012 8:15 PM
AURlyW fnxnpeknwurd

lalagumball | 2/25/2012 4:53 AM
Thanks Alexandra. I can see myself getting a lot of use out of this sweater! Bonus points that it's handmade by Nanny and passed down in the family. xo viagra cheapest car insurance

Jaydee | 3/8/2012 1:00 PM
Paki, aunque con retraso, te comunico que todos los que lo solicist teis a trav s de los coemntarios est is admitidos/as car insurance online car insureance

Alexavier | 3/13/2012 4:44 AM
Paki, aunque con retraso, te comunico que todos los que lo solicist teis a trav s de los coemntarios est is admitidos/as cheap auto insurance online cheap health insurance


Coach Outlet Canada | 5/5/2012 7:59 AM
Welcome to buy

Cheap Coach Purses

for sale online if you want to get the best price for your dream coach on

Coach Purses Outlet

.

Coach Online Outlet

have various types for your choices in

Coach Purses Outlet

, you'll find selections to meet any budget from

Coach Outlet Online

. Here are some detailed of discount

Coach Online Sale

.Elegant and noble will be the distinctive characteristic of authentic
User verification Image for user verification  
     

Tags

Archive

Authors

Pasi Matilainen

Pasi is a Software Specialist working at Digia, Qt Commercial R&D and he concentrates on Mac OS X development. Pasi holds an M.Sc. degree in Information Technology from the Tampere University of Technology, Finland.

Tarja Sundqvist

Tarja is a Senior Software Engineer in the Digia, Qt Commercial Support team. She has been working in Digia for over 10 years in various positions: software development, testing, error management. Now, Tarja is focusing on helping Qt Commercial customers with their daily Qt problems on Windows and Linux platforms. Tarja holds an M.Sc. degree in Information Processing Science from the University of Oulu, Finland.

Akseli Salovaara

Akseli is a Software Specialist at Digia, Qt Commercial R&D and is responsible for the Qt Commercial releases and deliveries. Akseli holds an B.Sc. degree in Information Technology from the University of Applied Sciences in Jyväskylä, Finland.

Samuli Piippo

Samuli is a Software Specialist at Digia, Qt Commercial R&D with a concentration on  embedded Linux and RTOS development. Samuli holds an M.Sc. degree in Information Processing Science from the University of Oulu, Finland.

Katherine Barrios

Katherine is the Marketing Manager at Digia, Qt Commercial. She is responsible for getting the word out about Qt Commercial to the Qt ecosystem and working together with our customers and the Qt community to further extend the love for Qt on desktop and embedded. She was previously employed at Nokia, Qt Development Frameworks as Program Marketing Manager and is based in Oslo, Norway.

Sami Makkonen

Sami is a Senior Product Manager working at Digia, Qt Commercial R&D and he is responsible for the product planning including new feature development and enhancements to existing functionality. Sami holds an M.Sc.(Econ.) degree in Computer Science.

Andy Shaw

Andy is the Head of Support at Digia, Qt Commercial and has been working with Qt and supporting customers using Qt for 11 years.  He thrives on solving customer problems and getting feedback from them.

Tuukka Turunen

Tuukka is the Director of R&D at Digia, Qt Commercial and is responsible for the planning, creation, verification and delivery of the Qt Commercial product. Tuukka holds a M.Sc.(Eng) and Licentiate of Technology degrees in Computer Science.

Qt Commercial Team