Draw only what needs to be drawn, so culling and z-ordering can only help more
The ideal is to get a higher framerate which is perceivably better experience for the user. For 2D graphics, 16 frames per second is satisfactory. But for 3D graphics, 30 frames per second seems to be tolerable, but 60 frames per second is the minimal. But if you’re just learning 3D graphics programming, don’t worry about frames per second, just worry about the geometry and math to make sure it is correct. Then you can optimize it when you’re confident you understand how it all works.
The main reason I had to rollback to using Qt 4.8.5 since I was developing on Qt 4.8.7 on a Windows 7 machine was because after upgrading to Windows 10, my 4.8.7 apps failed in so many levels. Something as simple as loading an image was completely broken. I did a little digging and it turns out since Qt 4.8.6, support for versions of Windows before version 10 was dropped. So instead of gambling with newer versions of Qt that just won’t work on my “old” development Windows machine, I have to count on the versions of Qt that will. And Qt 4.8.5 was the last functioning version that seemed to be supported by most Windows versions.
I had to abandon Qt 4.8.7 because it just doesn’t work on Windows 8 and later versions. So I reverted back to Qt 4.8.5 and had to rewrite EVERYTHING. But it works now and maybe even better. Shorter code and faster runtime. Might have to do with learning better tricks. But check it out!
For many Qt lovers out there who might want to use third-party EXIF parsing library with their Qt apps, it may prove difficult unless you know what you’re doing. If you’re a hobbyist like me, man, it’s just tough. But there are free EXIF parsers out there, and it might take a little elbow grease to make it work with Qt. In my case, I put together a very simple and basic image viewer that I thought users might appreciate if it auto-rotated any images that contained EXIF metadata such as orientation. In smartphones and DSLRs, there is usually a sensor that records which orientation the picture was taken in. So when you view the photo without orientation applied, it might be a minor nuisance having to manually rotate it. That’s where you come in as software developer and take care of it for the end-user. Continue reading “How To Read EXIF Orientation From JPEG in Qt 4.8.5”
You may notice if you’re still deploying applications using resolutions less than 800x600x72dpi on Windows 10 that the autoscaling for the aspect ratio might be wonky. That’s because all these new fancy operating systems are trying to cater to ultra high resolution/density screens these days, and if you’re building an old-fashion 2D game engine that doesn’t require too much screen resolution, the final output might be thrown off a bit. Sometimes it’s just the graphics card, but in Windows 10 case, it seems it’s built into the operating system. Anyway, this is how I “fixed” it.
It’s actually a little more advanced than SNES Mode 7 because it’s real 3D. Yes, Nintendo’s Mode 7 was 3D, but the limitation was to the ground plane. I needed to have better understanding of how a 3D engine worked so that mapping of objects went smoothly. So where ever I place a 3D object into the world, is also where I can place a 3D “plane” that I can use a 2D texture as a 3D sprite. For example, say I wanted to put a tree or stop sign on the map for a racing game similar to F-Zero.
Qt 4.8.7 differs greatly from Qt 4.8.5 in that they’ve wanted to provide more access to Windows 7 and later API. This makes the versions’ dependencies incompatible when you distribute your apps. So pay attention.
Downloads (For Distribution/Standalone Runtime):
48 KB (UPX compressed)
409 KB (UPX compressed)
25 KB (UPX compressed)
1.1 MB (UPX compressed)
4.1 MB (UPX compressed)
And for image format support:
2.3 MB (UPX compressed)
And for Phonon to work:
121 KB (UPX compressed)
143 KB (UPX compressed)
182 KB (UPX compressed)
1.5 MB (UPX compressed)
1.4 MB (UPX compressed)
qt487_dependencies_upx.zip – contains all minimum dependencies to run my Qt 4.8.7 apps
NOTE: Not available yet, I’ll update this when I have working demo
Here’s a demo of “real” 3D in pure Qt. It doesn’t rely on third party 3D libraries like OpenGL, DirectX, or even Qt’s own convenience class QTransform. It’s actually very simple. It uses a very simple trigonometry function for rotating a point you can get off of Wikipedia. Everything else has to be calculated manually, but it works. The geometry is accurate. But so far this is only a work-in-progress and I haven’t quite figured out the texture mapping. But the fact that the faces can have textures mapped to them, yes with QTransform, means it’s ready for Mode 7 if you just want to put up single plane “sprites” as obstacles in an F-Zero or Mario Kart-like game. But I want to have full 3D boxes or buildings or platforms.
The Phonon documentation provided by Qt isn’t thorough because Qt stopped providing support for it after awhile. So you’ll have to do extensive scouring of the Internet to make even your most basic Phonon app work. Here’s how:
When you’re coding, you can add the #includes, but you’ll notice the compiler may give errors. That’s because you have to dig pretty deep in the Phonon documentation provided by Qt in order to find out how to use their moc system. So make sure you add:
Qt += phonon
to the line in your QCreator *.pro file before you compile your application.
So when it’s time to deploy, make sure when you distribute your Phonon-based application to copy these folders to be distributed with your final Windows self-executable (*.exe format), which can be found in your Qt 4.8.7 installation folder %Qt%/plugins/
You’ll also need the following DLLs to be distributed too, so copy them from Qt installation folder %Qt%/bin/
So once these folders and files have been distributed with your Windows self-executable, you should be able to play basic media files such as WAV and AVI formats. Other formats like MPG, MP3, MP4, AAC, MIDI, WMV, MOV, OGG, FLV may require additional codecs and programming. But the only way you’ll know for sure is to test them. Otherwise stick with formats you know for sure Windows (or your target deployment operating system) supports.