Advertisement

OpenGL API and structures

Started by October 16, 2017 07:27 AM
1 comment, last by blueshogun96 7 years, 3 months ago

This question is relative to OpenGL 1, and i suppose subsequent versions as well.

Is there a reason that OpenGL 1 doesn't expose any structures? It seems like the API went trough a lot of trouble to not define any standard structs. Is intentional for some reason like to mitigate for compiler quirks, or to not have to deal with structs being padded differently by compilers? Or is this just coincidence?

Why OpenGL 1.x does not contain structures is not a question I have a direct answer for, but my assumption is that it would be better designed that way so driver developers can keep the most complex stuff internal and privatized in their driver code.

Not sure if you know this already, let's take a brief look at why OpenGL came about in the first place.  Before OpenGL was even thought of, there was an API called PHIGS back in 198x.  From what I've read, the main issue with PHIGS is that ultimately it didn't give the developers what they needed in many instances.  So SGI initially created Iris GL, which eventually became the basis for OpenGL in January 1992.  Unlike PHIGS, OpenGL had a simplified state machine and supported an "immediate mode" rendering component.  AFAIK, simplicity was the overall goal, while having a standard that graphics hardware could support via software or hardware all across the board and with little setbacks as possible. 

Prior to what we have today, programming graphics hardware was quite a task and all sorts of structs were everywhere.  I mean, if you take a look at how NVIDIA's gfx registers were laid out and accessed back in 199x (hello NV1 and Riva128), you'll see that each channel is just a series of structs.  OpenGL was meant to simplify graphics programming greatly.  Keep in mind that it was not originally designed for games, but for CAD, 3D simulations, and so forth.  Not that it really matters though...

This is just my two cents.  If I'm wrong about any of this, someone feel free to correct me.

Shogun

This topic is closed to new replies.

Advertisement