OpenGL for Macs?

BlitzMax Forums/BlitzMax Beginners Area/OpenGL for Macs?

Grey Alien(Posted 2006) [#1]
So if I want to make a game cross platform (i.e. run on Macs and Linux?) I should use the OpenGL driver right? Years ago, OpenGL was really slow, I assume that now it's as good as DirectX right?


ImaginaryHuman(Posted 2006) [#2]
Yes Mac and Linux don't and won't have DirectX, so if you are looking for cross-platform compatibility, you want to provide at least OpenGL displays for when running on Mac/Linux machines. If you want you can still use DirectX for when running under Windows. Or you can just do OpenGL across the board and ignore DirectX :-)

As to the speed it depends on the graphics card and driver mostly. For some people it seems that OpenGL is faster than DirectX, and for other's it is vice versa. With the upcoming Windows Vista, OpenGL might be slower as it's taking a back seat to DirectX. But on Mac and Linux, OpenGL is well supported since it is the main graphics model. On the Mac it has generally good drivers that are fast.

I have an Imac G4 1Ghz which has a GeForce MX 4 Nvidia gfx card. Being a Mac it means anything I do on it via BlitzMax will be OpenGL. It is highly hardware accelerated, and I get some pretty good performance as a sort of `mid range` set up. It can certainly throw around plenty of pixels/texels, do the 3d transformations, etc. Obviously there are limits based on the card/hardware, as always. But in general I am quite pleased with the performance.

Some people don't like OpenGL, while some people don't like DirectX - largely personal preference. I think OpenGL is good, though it's better in the higher versions - there's a few areas that are a bit lacking for features on the basic 1.2 BlitzMax version, but overall it's very good.


Grey Alien(Posted 2006) [#3]
ok thanks for the info :-)


xlsior(Posted 2006) [#4]
If you don't specify, Windows BMax exe's will default to DirectX (which is typically faster on windows), and fall back to OpenGL if DirectX couldn't be initialized.

On Linux & Mac, all that is available is OpenGL, so that's the default (and only) display driver you can use.


Grey Alien(Posted 2006) [#5]
If you don't specify, Windows BMax exe's will default to DirectX (which is typically faster on windows), and fall back to OpenGL if DirectX couldn't be initialized.
that's worth know thanks. I guess then I can read the graphics driver to work out if I'm on a Windows PC or Mac/Linux? or is there an easier way to figure out if I'm in Windows?


Yan(Posted 2006) [#6]
Compiler directives.

I know I'll probably regret asking this...But...Why would you want to?


xlsior(Posted 2006) [#7]
that's worth know thanks. I guess then I can read the graphics driver to work out if I'm on a Windows PC or Mac/Linux? or is there an easier way to figure out if I'm in Windows?



It shouldn't really matter what OS you're in... Technically you already know what OS you compiled the code for since you had to use that actual OS to do so, but if you want to compile your code unchanged and figure out after the fact which platform, you can use compiler directives. Example from the BlitzWiki: http://www.blitzwiki.org/index.php/Category:Compiler_Directives

?debug
	Print "debug on"
?


?win32
	Print "win32"
?macos
	Print "macos"
?linux
	Print "Linux"
?


?x86
	Print "x86"
?ppc
	Print "ppc"
?



Grey Alien(Posted 2006) [#8]
ok great thanks.