Jump to content
  • Advertisement
Sign in to follow this  
vs322

OpenGL D3DXVECTOR replacements

This topic is 4038 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I am currently re-writing an engine to make it more portable, (perhaps switch it to openGL and linux). Anyway, my issue is with picking and some of the movement calculations I have use D3DXVECTOR. And I don't want my directX mingling with my game objects etc. And I want my picking system to be totally independent of my rendering system (would like to anyway). But there are so many helper functions and math operations for the d3dxvec class that I don't want to completely re-write it. is anyone aware of a platform independent vector/matrix library or solution that is as capable as the directX versions? -thanks

Share this post


Link to post
Share on other sites
Advertisement
How we all wish it were so... ;) There is a math library called G3D, but I've heard complaints about it. It seems every single person who does graphics programming has a need for a such a library. It's hard to get everyone to agree on the requirements and actually write one.

Share this post


Link to post
Share on other sites
The other option is to wrap the platform specific stuff in a platform independent way. So the interface is the same on all platforms but the implementation takes advantage of whatever optimised platform specific libraries exist (such as D3DX).

Most D3DX maths helper functions that you would want on other platforms such as those for picking only rely on D3DX types, not D3D types which only makes their names and internal implementations platform specific, not their use.


#if USE_D3DX==1
class PlatformIndependentMatrix : public D3DXMATRIX
...
typedef PlatformIndependentVector D3DXVECTOR4;
...
inline PlatformIndependentPick( const PlatformIndependentVector& blah,... )
{
D3DXBlah(...
}
#elif USE_GLUT==1
...



Done carefully (inline where it matters, care with constructors, avoiding unnecessary virtual inheritance, etc) there should be little to no performance difference.

You have to be careful what methods you do and don't expose and exposing members directly can be problematic - which requires up front knowledge of all the libraries you're going to wrap. On some platforms you'll have to implement certain methods/functions yourself too.

Share this post


Link to post
Share on other sites
I think that I am gonna go ahead and implement things myself as I need them. If it gets to complex I'll go the wrapper route. Thanks for the suggestions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!