Hi,
How would you get a DirectX based game to work nativley on a mac? For example, CS:GO, that uses DirectX's full capabilities, but yet this game is still compatible on a mac, so how would you get this clearly mac-unfriendly app to work on a mac?
This question isnt something that would directly affect me, as my games programing is curently only Win based (mainly because of this ongoing GL vs DX debate)
Thanks,
L99
3 Replies - 539 Views - Last Post: 12 October 2012 - 09:28 AM
#1
DirectX Based Game On A Mac? How Did Valve Do It?
Posted 10 October 2012 - 01:26 PM
Replies To: DirectX Based Game On A Mac? How Did Valve Do It?
#2
Re: DirectX Based Game On A Mac? How Did Valve Do It?
Posted 10 October 2012 - 02:49 PM
It's likely that on a Windows platform the code makes calls to a DirectX layer, but on the Mac calls are made to another layer that clearly can't be DirectX.
Google 'cross platform game development'.
Google 'cross platform game development'.
This post has been edited by ButchDean: 10 October 2012 - 02:50 PM
#3
Re: DirectX Based Game On A Mac? How Did Valve Do It?
Posted 12 October 2012 - 05:03 AM
They could quite easily (and probably did) have a graphics renderer interface
Then it's simply a case of creating the correct renderer at runtime (a config file) or compile time:
Of course this is a very rudimentary example, but you get the idea
class IGraphicsRenderer
{
public:
virtual bool InitGraphics() = 0;
virtual void RenderScene() = 0;
};
class DXRenderer extends IGraphicsRenderer
{
public:
bool InitGraphics();
void RenderScene();
};
class GLRenderer extends IGraphicsRenderer
{
public:
bool InitGraphics();
void RenderScene();
};
Then it's simply a case of creating the correct renderer at runtime (a config file) or compile time:
int main()
{
IGraphicsRenderer* pRenderer = new GLRenderer();
pRenderer->InitGraphics();
while(running) // this doesn't care about the type
{
pRenderer->RenderScene();
}
return 0;
}
Of course this is a very rudimentary example, but you get the idea
#4
Re: DirectX Based Game On A Mac? How Did Valve Do It?
Posted 12 October 2012 - 09:28 AM
Another option would be to write interface/wrapper code rather than the example you have given. In such a case you specify overrides externally to the game engine as part of a library.
(Edited to clarify.)
(Edited to clarify.)
This post has been edited by ButchDean: 12 October 2012 - 05:36 PM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|