• Advertisement
Sign in to follow this  

OpenGL & DirectX

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

is it possible to write programs using both OpenGL and DirectX? If so, where could I learn to do that? Or is there someone who could tell me how? If not, which is better and where can I learn to program in that style?

Share this post


Link to post
Share on other sites
Advertisement
I don't know anything about DirectX, being a Mac user, but I would think that since people are always talking about "OpenGL VERSUS DirectX" that they wouldn't be compatible. On the Mac side, OpenGL is optimized to work with our graphics cards, so if you're looking for a broader audience, go OpenGL. I personally use OpenGL and SDL.

Share this post


Link to post
Share on other sites
It's very possible. I don't think anyone has written anything on it because it's pretty easy to do, honestly. Once you get some more programming under your belt you'll know how to do it yourself. It'll be one of those "wow, it was that obvious?" things.

In the meantime, i suggest going with OpenGL, but i'm a sucker for open/cross platform standards. Check out NEHE's tutorials to get started.

Share this post


Link to post
Share on other sites
I didn't know that Mac didn't support DirectX. I guess, if I can find out if the 2 are compatible, it's possible to run 2 programs, one for Mac, and another for Windows. Well, is there a place I can find out about DirectX? There wouldn't happen to be a lib that I'd have to get to use with C++, would there?

Share this post


Link to post
Share on other sites
Quote:
Original post by PokeDestiny
I didn't know that Mac didn't support DirectX. I guess, if I can find out if the 2 are compatible, it's possible to run 2 programs, one for Mac, and another for Windows. Well, is there a place I can find out about DirectX? There wouldn't happen to be a lib that I'd have to get to use with C++, would there?


OpenGL is the standard Graphics API used across platforms. DirectX is the standard API for Windows not just for graphics but for sound and input. It was created for Windows by Microsoft is ONLY on Windows. OpenGL programs will be the easies to port but it is only graphics and not input.

The two aren't directly "Compatible" but you can do more or less the exact same thing in both Graphics wise. If you want to use both you would wrap the API specific code inside your own function. You then call your function and it does OpenGl or DX depending on what you are using at the time. If all this is making your head hurt then its time to go back to the books for some more research. My advice is if you have to ask how you can use both then your not ready to use both. Pick one and only one, then make something.

As for finding out information on DX there are many places, books, and what not on the subject. First thing you will need is the DirectX SDK which also comes with documentation. Google Starting DirectX and see what you get. If your hardcore interested in Cross platform stuff then go with OpenGL but you will also need something like SDL for audio and input.

Share this post


Link to post
Share on other sites
It's like you're comparing the engine from one car with the entirety of another car. The direct comparison can only be made between OpenGL and Direct3D. The other parts of DirectX - DirectSound, DirectInput, and so on - will quite happily coexist with OpenGL. From a technological point of view, the major parts of DirectX are completely separate; the only reason it's referred to as a single 'DirectX' thing is because of the way it's shipped and marketed.

As Goober King has said, OpenGL and Direct3D do pretty similar things - after all, at the end of the day it's the same graphics hardware that they're controlling, so all that really differs between the technologies is the way they expose that hardware to you.

Of the two, if you're working on Windows, I personally prefer Direct3D, as my experience of the tools for it has been much better - the DirectX SDK includes tools like PIX, which lets you examine in detail the Direct3D calls made by your application, and lets you explore the effect of each call on the framebuffer, the data they use, etc etc.

Share this post


Link to post
Share on other sites
I must stress that OpenGL / SDL are compatible with Macs and PCs, so if you're going to be cross-platformal, go for OpenGL. If you don't care about Macs, then take DirectX just because it has sound, input, etc. built into it. I must say that OpenGL uses a no-nonsense method of working its magic, although I know nothing of DirectX.

Share this post


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

  • Advertisement