Opengl/DirectX OOP
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.
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.
Both are OO, however OpenGL's bind-to-edit semantics significantly complicate its use. You need to be very careful with bound state. Either:
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).
- 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).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement