170 likes | 274 Views
3D graphics in Erlang. Jakob Cederlund - jakob@gnodata.se Björn Gustavsson - bjorn@erix.ericsson.se Dan Gudmundsson - dgud@erix.ericsson.se. 3D graphics in erlang. 3D graphics with hardware acceleration OpenGL - an open version of SGI’s GL Reasonable API Open standard
E N D
3D graphics in Erlang Jakob Cederlund - jakob@gnodata.se Björn Gustavsson - bjorn@erix.ericsson.se Dan Gudmundsson - dgud@erix.ericsson.se
3D graphics in erlang • 3D graphics with hardware acceleration • OpenGL - an open version of SGI’s GL • Reasonable API • Open standard • Cross platform (Wintel, Linux, Sun, Mac) • Widespread support from hardware • SDL - a library supplementing OpenGL with interaction, 2D graphics and more
erlang and 3D graphics • erlang high level language • 3D graphics needs symbolic language • Fast development • Performance critical code mostly in 3D hardware and drivers
ESDL • An erlang driver that interfaces with SDL • Supports most OpenGL calls • Fast • Optimized C driver • Uses binary syntax • Available as download from contrib area • Written by Dan Gudmundsson
ESDL erlang 3D program esdl-driver esdl SDL lib OpenGL 3D hardware
Wings - a 3D modeller in erlang • Uses erlang as functional language • Fast development • Good performance • Powerful • Innovative user interface • Inspired by Nendo • Written by Björn Gustavsson • Some inspiration from Jakob Cederlund
Wings • Most of the erlang code not performance critical • Some functions optimized • Winged-edge structure for 3D objects • Uses gb_trees and gb_sets (included in OTP R8)
Wings - features • Powerful modelling • Every operation applicable to several objects at the same time • Imports and exports to different formats • Wavefront • 3D studio • Easy to do easy things • As opposed to other 3D modellers
Wings - development • Functional • Only one process • Process dictionary used in for GUI state • Some things suprisingly easy to do • Multiple undo, with shared data • Only updates appriopriate parts of the model • Continues after crash, e.g. to save work • Just a catch, saves dump to file • Library functions used • gb_sets and gb_trees (R8) • sofs - Sets OF Sets (R8) • digraph and digraph_utils
Wings - development cont. • Funs used a lot • special fold operations to iterate over model elements • Optimization after implementation and testing • Data structures hidden, used via functions • Most user commands uses primitive commands • Example inset • Extrude • Scale
Wings - examples • Rendered in Bryce, composited in PhotoShop
Wings - examples cont. • Modelled in only 5 minutes! • Rendered afterwards in Bryce
Wings - performance • Most things fast enough • Optimized floating point in R8 • Some things take time • Smooth • Dissolve • Used as primitive by many commands • erlang fast enough, even for interactive tasks
Wings - future • Long to-do list • Ongoing development, bugfixing and new features • Future features • Plug-ins, both in erlang and C • More export formats, e.g. renderman • Cameras, multiple views • Materials, textures • New platforms (MacOSX)
Wings - availability • Open source • Full source on sourceforge • Compiled versions • Currently requires otp, esdl and SDL • Stand-alone erlang version with installer will be available shortly • Documentation and examples • Home page http://www.erlang.org/project/wings/