About Me

Hi. I'm Josh Ols. Lead Graphics Developer for RUST LTD.

Contact:
crunchy.bytes.blog[at]gmail[dot]com

View Joshua Ols's profile on LinkedIn

Meta
« Cheap specular lighting | Main | AA + HDR encoding »
Sunday
Jan102010

OGL -> D3D

For my project, I wanted my renderer to use OpenGL only, so I'd have a mostly unified codebase for all the potential PC platforms (Win, Mac, & Linux). Sadly, I'm finding that things just aren't that simple in practice when it comes to getting the best performance. For Windows 7, in particular, I'm just not going to get the best performance unless I use Direct3D.

So I've decided to develop my codebase like I would for a cross-platform console game. I will make high-level platform-neutral abstraction, with low-level platfrom-specific code. That means using the APIs that provide the best performance and feature access for the platform. Thus I will use DirectX on all things Windows, and OpenGL/OpenAL/etc everywhere else (barring console development).

Other than that, aside from platform-specifics I'm only going to use APIs that don't have a licensing fee attached to them.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (4)

OGRE is a very nice cross platform graphics engine (http://www.ogre3d.org/) it uses the Nvidia CG library to compile sharers into both hlsl and glsl compliant code. This allows you to write sharers in one language (CG) and use them in both OpenGL and DirectX.

http://developer.nvidia.com/object/cg_toolkit.html
February 23, 2010 | Unregistered Commenterthe_best_flash
You aren't the first to suggest I use OGRE, and I do indeed see the merit in using a premade, well-established rendering codebase. However, part of the reason I am writing all my own code is so that I can learn the gory details of computer graphics.

Thanks anyway.
February 24, 2010 | Registered Commentern00body
That makes sense. I meant, however, to suggest that you use the CG library, and gave OGRE as an example of an engine that implemented the CG library.
February 24, 2010 | Unregistered Commenterthe_best_flash
Actually, I have been using Cg for my project thus far. I am planning to switch to HLSL when I move my code over to D3D. The two are close enough that I can accommodate any differences with preprocessor definitions and macros.
February 24, 2010 | Registered Commentern00body

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.