Jump to content
  • Advertisement
Sign in to follow this  
Quisnam

Opengl/DirectX OOP

This topic is 3179 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
Advertisement
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
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!