View Full Version : Object-Oriented
08-17-2000, 03:55 PM
I am a DirectX programmer who has been trying out OpenGL for a week. For 95% of my programming, I organize my code into classes and interfaces because they show how data and functions relate to eachother. I think that OpenGL should be organized into interfaces (ie., abstract base classes) similarly to how Direct3DRM is organized - with viewport objects, scene objects, frame objects, mesh objects, light objects, etc.
The philosophy behind OpenGL is just an abstraction over the graphics hardware. What you're advocating is a framework, which is meant to sit ON TOP of the h/w.
08-18-2000, 09:47 AM
Agree with John. I use C++ pretty much exclusively, and like you I organize almost all my code into classes. But I wouldn't ever want to see OpenGL become a retained-mode API.
As John said, OpenGL is a hardware abstraction; with its strongly orthogonal design it's more like an instruction set for a graphical VM than a "normal" API. This flexibility lets you mix and match primitive operations to achieve functionality that the original designers never expected - from stencil shadows to Life to volume CSG to Voronoi diagrams to audio mixing (!) to Renderman shader compilers...
When you move to a C++ design most of that flexibility disappears; it's the price you pay for encapsulation. If you want a C++ wrapper, fine. There are any number of them out there (including Inventor, which has just been open sourced). If they don't quite fit, write your own; it's a fairly trivial exercise, and you can make sure it does what you need it to. The "one size fits all" mentality of D3DRM is never going to be satisfactory to a large proportion of gfx programmers.
08-21-2000, 02:06 AM
To be more specific, I wanted some class wrappers in addition to the existing structured approach, which means that you do not have to use the wrappers but you can use the current way instead. The class wrappers would be the most useful if they were open-source so other programmers could use them for cut-and-paste templates for their own custom wrapper.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.