Here comes a hardware-assisted OpenGL blitter for OpenTTD!
Why not hardware-'accelerated' you say? Because it's not necessarily faster
Remember to disable VSync if you want to fast-forward beyond 60fps, and do not force texture AA
since it'll blow up color indexes ...
And please notice, don't press the full-screen key like Alt+Enter, and don't choose prebaked resolution from options window, they simply don't work (yet) ...
Currently it supports Win32 platform, and those platforms with SDL OpenGL support.
(well SmatZ told me he successfully wine openttd.exe
under Linux for this one
It needs multiple draw buffer and fragment program (pixel shader) support to correctly draw colored text, re-colored buildings, company colors, etc. Which means you must have at least NVIDIA GeForce 6100, ATI Radeon 9550 or Intel GMA X3100 to fully utilize it.
Fixed a bug that sometimes cause repeatedly encoding of PNG sprites, possibly eat up all available memory ...
For binary please refer to my Patch Pack
EDIT6: Updated the patch so that MinGW/Cygwin users can build it correctly. Also it won't compile OpenGL stuff anymore while OpenGL is not enabled. Bugfix in SDLGL driver too.
The OpenGL blitter itself isn't changed much however. I was trying MSAA but didn't get very pleasant results yet ...
EDIT5: Updated the patch to include SDL OpenGL video driver hacked by ccfreak2k
And also supported MinGW/Cygwin compiling. Just run ./configure with '--with-win32gl' or '--with-sdlgl' (or both) then 'make' as usual. Linux/Mac users please test if SDLGL driver works on your machines! And ... anyone wish to hack a OSX native OpenGL driver for us?
EDIT4: This version should do pretty well on both ATI/NV cards. And you could even try it on Intel 915/945 integrated graphics (but without palette animation ...)
EDIT3: ATI users please try the new binary and report if it displays anything. Be sure to disable force mipmap, texture anti-aliasing to get a pretty screen.
EDIT2: With ccfreak2k's help I've identified some potential fix to make it (partially) work in ATI cards, but by no means perfect. I'll update the patch once I got (at least) map panning works on a capable ATI card.
EDIT: bokkie reported that it DOES NOT WORK on ATI X1950PRO
, and ccfreak2k reported it DOES NOT WORK on ATI X850XT
either. Perhaps anything using ATI graphics chips have some degrees of problem ...
Since I don't have PCs with capable ATI cards nearby, any debugging assistances are welcomed. (Perhaps I did something strange with shaders?).
You can run this little program to see if your system have needed extensions. (notice: it's a console/text mode program)
File comment: Extension checker
ext-check.zip [172.51 KiB]
Downloaded 560 times
If your system doesn't have needed extensions, it's better to stick with 32bpp-anim/32bpp-optimized blitter until you decided to upgrade your system/graphics card
Perhaps I will modify it later, so Intel 915G can at least display remapped colors correctly, but I'm gonna 'play' OTTD now
You should use the supplied openttd.cfg or put these two lines in yours, to enable OpenGL blitter. You can also adjust the opacity of transparent objects (buildings) between 0-255, smaller values are more transparent, larger values will yield a more 'solid' black shadow.
videodriver = win32gl
blitter = opengl
transparent_opacity = 64
You can also start openttd.exe with
-v win32gl -b opengl
And since it's a 32-bit blitter, I strongly recommends to use a TrueType font with anti-aliasing enabled!
medium_font = Arial
medium_size = 11
medium_aa = true
If you need Chinese/Japanese/Korean support, and you got MS Office installed, you can try 'Arial Unicode MS'. It works great too.
If you want to compile it yourself, you'll need GLee (GL Easy Extension) library from http://elf-stone.com/glee.php
. Extract GLee.c/GLee.h and put them in 'src' directory.
'opengl' blitter is platform-independent, with help from 'win32gl' video driver, which is hacked from 'win32' video driver, to do Windows-specific OpenGL initialization, and usual environment/input management. In theory we just need other platform-specific drivers to do OpenGL initialization and management, to use 'opengl' blitter on these platforms.