Sign in to follow this  

Opengl/DirectX OOP

This topic is 2957 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 have been making games in C++ for quite a while, but always using GDI++ and the console. I had some experience with DirectX but it didnt go too well, so I have decided to increase my overall C++ knowledge first. Recently, I have decided its time to really learn a 3d API. I'm using allot of OOP and I think using OOP generates cleaner code, so I'm wondering which of the two most popular 3d API's (Opengl and Directx) is better suited for an OOP aproach? Thanks in advance.

Share this post


Link to post
Share on other sites
Quote:
Original post by Quisnam
which of the two most popular 3d API's (Opengl and Directx) is better suited for an OOP aproach?

Both are object oriented, but OpenGL does object management in C style - you work with objects through OpenGL's functions rather than through classes.

Share this post


Link to post
Share on other sites
Both are OO, however OpenGL's bind-to-edit semantics significantly complicate its use. You need to be very careful with bound state. Either:

  • code defensively and always reset state to its previous condition before returning from a method, or

  • trash state at will, but make sure that every method resets it to a known condition when called


Unfortunately, both approaches carry performance penalties.

There is work being done on a direct-state-access extension that would bring OpenGL on par with D3D on this front, but this will take some time before becoming a core feature (if ever).

Share this post


Link to post
Share on other sites
Thanks for the replies lightbringer and Fiddler.
I think using DirectX would be better for me in this case, I'm not worried allot about it being crossplatform, plus I'm used to MSDN already.
Got to finish some of my old projects first, then I'll be learning DirectX.

Share this post


Link to post
Share on other sites

This topic is 2957 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this