13

I'm looking into linux and Graphical API's, however I'm confused at how opengl is implemented in operating systems. Is it just a set of libraries that use the kernel to "talk" to your graphics card about which pixels to colour or not? if so then I don't know where the pipeline comes in - how 3D scenes are rasterized and shaders effect geometry.

And How Come GPU's can support shader languages from both DX and OGL? - and where do shader languages actually fit?- are they compiled, or interpreted at runtime?

I don't have very much experience with graphical API's myself despite using several game engines - usually the nitty gritty is far lost with several layers of abstraction.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 2
    You could have a look this series of blog posts that may enlighten you : http://fgiesen.wordpress.com/2011/07/01/a-trip-through-the-graphics-pipeline-2011-part-1/ – rotoglup Jun 16 '12 at 22:15
  • 3
    possible duplicate of [How does OpenGL work at the lowest level?](http://stackoverflow.com/questions/6399676/how-does-opengl-work-at-the-lowest-level) – datenwolf Jun 16 '12 at 22:50
  • Possible duplicate of [How does OpenGL work at the lowest level?](https://stackoverflow.com/questions/6399676/how-does-opengl-work-at-the-lowest-level) – BDL Aug 08 '19 at 17:26

3 Answers3

5

I explained it thoroughly here: https://stackoverflow.com/a/6401607/524368 and here https://stackoverflow.com/a/7967211/524368

Community
  • 1
  • 1
datenwolf
  • 159,371
  • 13
  • 185
  • 298
1

At least on most typical graphics cards, most of the OpenGL pipeline (fixed or programmable) is implemented in the graphics hardware itself. This is even more true of DirectX (i.e., DirectX is missing quite a bit of functionality in OpenGL that's not directly supported by current hardware).

Shaders are normally compiled. The graphics card has a special purpose processor (or, often, more than one) so the compiler takes the input in the shader language and turns it into the assembly language for that processor, much like a C compiler does for the CPU. Supporting different input languages isn't a whole lot different from a single CPU supporting input in C, C++, Pascal, Fortran, Cobol, etc.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
-1

I can't talk to how the API is implemented.

But I do know from experience that shaders are compiled. So you compile them and send them to your GPU where they're executed.

Mads
  • 724
  • 3
  • 10