3

Is there a programming language that has been explicitly created for computer graphics? I know that usually C and C++ are the most commonly used PLs for computer graphics but I want to know if there is a domain-specific language for CG.

genpfault
  • 51,148
  • 11
  • 85
  • 139
TheHube
  • 752
  • 1
  • 10
  • 23
  • I'd go out on a limb and say that C is probably not one of the more commonly-used languages for graphics. – Wooble Sep 10 '12 at 17:29
  • 1
    What are you trying do with respect to graphics? Build GUIs? Create 3D models? If you want to create hardware-accelerated graphics, OpenGL (which is an API for several programming languages) is pretty common. – Scott Sep 10 '12 at 17:30
  • 4
    Other than perhaps shading languages (Cg, GLSL, HLSL, RSL, etc.) I can't think of any. Though some of the languages mentioned have been used in a parallel GPU computation context as well... so perhaps they don't count either. – Bart Sep 10 '12 at 17:31
  • @scott654 I mean a full programming language (not Cg or GLSL or other) that allow has in its standard library some API like OpenGL. – TheHube Sep 10 '12 at 17:39
  • 1
    A good example of what I mean is Processing. But still it lacks of some features that allow it to become a production-level language. – TheHube Sep 10 '12 at 18:09

3 Answers3

6

Renderman was specifically created and has been used by Pixar and many others as a graphics DSL. You describe objects in the scene, attach shaders to them, add light sources, position cameras, describe projections, etc. All in this C-like language from the 1980s.

There are open source renderers that implement it & you can try it out.

Now that I think of it, perhaps POVray could be considered another.

Roger Allen
  • 2,262
  • 17
  • 29
  • +1: Renderman is the best example, IMHO. Even [Mental Ray](http://www.mentalimages.com/index.php), *the* premium rendering software for FX pipelines - still employs a shader tree architecture. – Brett Hale Sep 11 '12 at 10:43
0

Already mentioned in the comments, but I can't skip an opportunity to extoll the virtues of Postscript!

In the words of Bill Casselmann, author of Mathematical Illustrations,

Which [tool to produce sophisticated mathematical graphics] to choose apparently involves a trade-off between simplicity and quality in which most illustrators opt for whatever is perceived to be simplicity. The truth is that the trade-off is unnecessary; once you have made a small initial investment of effort, by far the best thing to do in most situations is to write a program in the graphics programming language PostScript. There is practically no limit to the quality of a PostScript program's output, and as one acquires experience the difficulties of using the language decrease rapidly. The apparent complexity involved in producing simple figures by programming in PostScript, as I hope this book will demonstrate, is largely an illusion. And the amount of work involved in producing more complicated figures will usually be neither more nor less than is necessary.

I spent the last two months working up a postscript procset to do 3D drawing. That's right: 3D -- from scratch -- in 2 months with a $10 used book, a text editor, and ghostscript.

Postscript graphics programs convert readily to PDF to share your creations with the non-postscript-aware world.

luser droog
  • 18,988
  • 3
  • 53
  • 105
0

MetaPost is an extremely useful domain-specific language for drawing mathematically-defined pictures. Although it can be used independently, it is widely used with LaTeX or TeX. As the name suggest, it's a high-level language producing PostScript (and actually PDF too). It is usually installed as an extra package of your LaTeX distribution.

Here you can find impressive examples of what MetaPost is capable of, usually with very compact code: MetaPost Examples.

Finally, in the following link you'll find a wealth of useful information on examples, tutorials, and how to get started: TUG MetaPost Page. Good luck!

naitoon
  • 665
  • 5
  • 14