Jump to content
  • Advertisement
Sign in to follow this  
yodaman

api abstraction... should I know d3d first?

This topic is 5411 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

I have been wanting to learn d3d now for a while and since im at the very beggining of a new project, I figured what better time then now? However, I want to be able to get things going with my project thus, learning d3d would really slow things down. What i want to know is this: would it be feasible to try and create a wrapper for the two api's without knowing d3d and then later on working on the d3d renderer? I figured probably not due to the fact that d3d works differently in many ways then opengl. Ex: Should I use d3d's math lib with opengl, or should I use a custum math lib for gl and d3d's well, for d3d? Hrm... Thanks a lot.

Share this post


Link to post
Share on other sites
Advertisement
Me and a friend created a plugin based API abstraction system for our engine. It supports both OpenGL and Direct3D and is rather low level, which makes it simpler. Its basically just a system to render vertex arrays and handle the matrix stack and different rendering states... We had to code both the D3D and the OpenGL renderer at the same time. For this we had to examine the common points between D3D and OpenGL. We were actually able to create a custom vertex format that would directly work with both renderers without dynamic modifications so it would run faster...

For the math library... Well, our engine doesn't even include the Direct3d or OpenGL library... So using the d3d math classes doesn't make much sense. And for the sake of portability, we used our own math classes (vector and matrix math). I surely like it better this way. I would certainly not want to use d3d math classes in my physics engine for example, so all my engine uses our custom math stuff. Theres also the fact that I prefer the way our math classes are organized.

Good luck on your project :)

Share this post


Link to post
Share on other sites
Hmm, apparently it isn't a good time to start learning D3D -- learning D3D will slow things down and you don't want that.

It seem like what you are really considering is to do the project using OpenGL now, and then port it to D3D later. I don't think a renderer-independent wrapper is worth the effort in this case, since that will also slow things down. It will only be useful if you plan to reuse it and once you figure out how to use D3D you will probably end up rewriting it anyway.

Perhaps the best plan is simply to make sure that your new project is organized very well and keep the coupling between the game and the renderer to a minimum. For example, don't do stupid stuff like calling rendering functions in the AI code or I/O functions in the rendering code. That will make it easier to port to D3D later.

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBolton
Hmm, apparently it isn't a good time to start learning D3D -- learning D3D will slow things down and you don't want that.

It seem like what you are really considering is to do the project using OpenGL now, and then port it to D3D later. I don't think a renderer-independent wrapper is worth the effort in this case, since that will also slow things down. It will only be useful if you plan to reuse it and once you figure out how to use D3D you will probably end up rewriting it anyway.

Perhaps the best plan is simply to make sure that your new project is organized very well and keep the coupling between the game and the renderer to a minimum. For example, don't do stupid stuff like calling rendering functions in the AI code or I/O functions in the rendering code. That will make it easier to port to D3D later.


A 3D API wrapper is one of the most important things in the design of a professional 3D game engine. It definitely simplifies things in the end, and helps you understand things better. If you know both D3D and OpenGL, and are able to design a fully abstract interface, then you have most of the knowledge you need in order to program your own renderer.

It took me and my friend a single week to program our abstraction system with support for OpenGL and D3D anyways, so where's the problem? The organizational benefits are just great.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!