Slashdot Mirror


Programmer Unveils OpenGL Bindings for Bash (opensource.com)

Slashdot reader silverdirk writes: Compiled languages have long provided access to the OpenGL API, and even most scripting languages have had OpenGL bindings for a decade or more. But, one significant language missing from the list is our old friend/nemesis Bash. But worry no longer! Now you can create your dazzling 3D visuals right from the comfort of your command line!
"You'll need a system with both Bash and OpenGL support to experience it firsthand," explains software engineer Michael Conrad, who created the first version 13 years ago as "the sixth in a series of 'Abuse of Technology' projects," after "having my technical sensibilities offended that someone had written a real-time video game in Perl.

"Back then, my primary language was C++, and I was studying OpenGL for video game purposes. I declared to my friends that the only thing worse would be if it had been 3D and written in Bash. Having said the idea out loud, it kept prodding me, and I eventually decided to give it a try to one-up the 'awfulness'..."

47 comments

  1. Dang it, I was hoping for 3D Accerlerated Bash by rsilvergun · · Score: 4, Funny

    imagine Fortune at 60 fps with 16x SOAA, God rays on Ultra and hair works. It would be glorious.

    --
    Hi! I make Firefox Plug-ins. Check 'em out @ https://addons.mozilla.org/en-US/firefox/addon/youtube-mp3-podcaster/
    1. Re:Dang it, I was hoping for 3D Accerlerated Bash by Anonymous Coward · · Score: 0

      https://github.com/jwilm/alacritty is a GPU-accelerated terminal emulator.

  2. Gtk Server, anyone? by K.+S.+Kyosuke · · Score: 2

    I thought that the Gtk Server allowed one to use GtkGlArea in scripts.

    --
    Ezekiel 23:20
    1. Re:Gtk Server, anyone? by Anonymous Coward · · Score: 0

      +5 insightful

      You can do some really neat things with a little known feature of bash - modules. There's a native sqlite3 for example.

    2. Re:Gtk Server, anyone? by silverdirk · · Score: 1

      Hey thanks for that link! I looked around for other similar projects, but was searching for "OpenGL" rather than "gtk".

      --
      Mark of the Coder fades from you. You perform Opening on World of Warcraft. Warcraft crits GPA for 4. GPA dies.
    3. Re:Gtk Server, anyone? by silverdirk · · Score: 1

      Do you have a link? I found https://linux.die.net/man/1/mo... but that is a standalone program and not really part of bash. The manual page is also clear as mud so I'm not sure whether it would have been practical to use. (and looks like I'd need to learn TCL to use it)

      --
      Mark of the Coder fades from you. You perform Opening on World of Warcraft. Warcraft crits GPA for 4. GPA dies.
  3. Maybe by PPH · · Score: 4, Insightful

    In the hands of responsible programmers. But what happens if you need to run a bash script from a character based console?

    Too many simple utilities have morphed from: Here's a command-line tool, and here's an optional graphical UI that runs on top of it. Next, we'll merge the graphics right into the basic tool's codebase. So you need to link every hair-brained graphics lib to build it. Finally, the damned thing will refuse to run (even if you use all the text-only command line switches) if it can't find a bitmapped display.

    --
    Have gnu, will travel.
    1. Re:Maybe by Anonymous Coward · · Score: 0

      "harebrained"

      please learn

    2. Re:Maybe by K.+S.+Kyosuke · · Score: 1

      With teratomas, anything is possible!

      --
      Ezekiel 23:20
    3. Re:Maybe by Anonymous Coward · · Score: 0

      It's hard to learn when your brain is a black hole. With hair. On its brane.

  4. brace yourself by lucm · · Score: 4, Funny

    Command-line ads are coming

    --
    lucm, indeed.
    1. Re:brace yourself by WallyL · · Score: 1

      Beware 3D
      coming to bash.
      It might cause ads
      Or the system to crash
      Burma-shave.

  5. So finally, something better about Bash than MSDOS by aberglas · · Score: 1

    Just imagine what 3D games would be like if they could be written in CMD batch language!

  6. I agree entirely by Anonymous Coward · · Score: 0

    With the sarcasm.

    I mean it is absurd that someone would use 64 bits to store a char, 40 times in a single program when they only have 10 gigabytes of ram!

    They should really be repeating those declarations because there is NO WAY the compiler could ever figure that stuff out! Could you imagine what would happen if we didn't impose strict limits on how easy things were, people just wouldn't understand!

    I MEAN WHAT WOULD THEY DO IF THEY HAD TO DECODE A PROTOCOL THAT WAS A SERIES OF BYTES WITH A CHECKSUM, THEY CERTAINLY WOULDN'T BE ABLE TO WRITE PROGRAMS AND SHARE THEM THAT ACTUALLY ACCOMPLISHED THAT ASTOUNDING FEAT!

  7. It would be like car autopilot by Anonymous Coward · · Score: 0

    And people NEVER having the chance to actually drive OFF ROAD!!!!

    FOR SAFETY OF COURSE.

    You fucking morons.

  8. Doing that for years.... by Anonymous Coward · · Score: 0

    $ glxgears
    (sees opengl)

    Good enough for me!

  9. OpenGL in BASH eh? by Anonymous Coward · · Score: 0

    Now lets see you do that in COBOL.

    1. Re:OpenGL in BASH eh? by glitch! · · Score: 1

      Now lets see you do that in COBOL.

      Of course! A PICTURE really should be a 3D picture, In EPCDIC of course.

      --
      A dingo ate my sig...
    2. Re:OpenGL in BASH eh? by Anonymous Coward · · Score: 0

      Extended Prime Coded Decimal Interchange Code?

    3. Re:OpenGL in BASH eh? by Anonymous Coward · · Score: 0

      I think you mean to say EBCDIC

  10. Re:So finally, something better about Bash than MS by Anonymous Coward · · Score: 0

    I for one, can't wait for someone to port Gorilla.BAS to 3D.

  11. Which version of OpenGL? by 140Mandak262Jamuna · · Score: 1
    Less than 1.8 with display lists?

    Or greater than 2.0 with shaders?

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    1. Re:Which version of OpenGL? by ArchieBunker · · Score: 2

      Don't AMD and Nvidia both have different OpenGL implementations?

      --
      Only the State obtains its revenue by coercion. - Murray Rothbard
    2. Re:Which version of OpenGL? by K.+S.+Kyosuke · · Score: 1

      At this point, don't settle for anything less than Vulkan!

      --
      Ezekiel 23:20
    3. Re:Which version of OpenGL? by silverdirk · · Score: 1

      1.x, since it's easier to prototype with, and because the codebase is 13 years old. I don't see any convenient way to assemble sets of polygons into buffer objects without a framework or modelling tool... but patches welcome!

      --
      Mark of the Coder fades from you. You perform Opening on World of Warcraft. Warcraft crits GPA for 4. GPA dies.
    4. Re:Which version of OpenGL? by 140Mandak262Jamuna · · Score: 1

      Thanks.

      --
      sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  12. Anything but Direct3D! by Anonymous Coward · · Score: 0

    Anything but Direct3D!

  13. Re: So finally, something better about Bash than M by Anonymous Coward · · Score: 0

    Wasn't that the last piece of published code written by Bill Gates?

  14. This story is too "technical" by Anonymous Coward · · Score: 0

    Can't we have more stories about "global warming" which invite us to share how we "feel" and how we are "concerened"? Stories about bash and OpenGL are too geeky for Slashdot.

  15. Re:So finally, something better about Bash than MS by Anonymous Coward · · Score: 0

    Next step: OpenGL in emacs.

  16. Just because you can... by trickyb · · Score: 1

    doesn't mean you should.

  17. Is this a joke? by Casandro · · Score: 1

    I mean if I was trying to make a joke about a C++ developer making shell scripts, I'd have used something like that.

    I mean seriously, you don't write built-in commands for that. You create a specialized language and write an interpreter for it. Once you have that, you can easily access it from the shell.

  18. comfort of your command line by mapkinase · · Score: 1

    You know how when you see the phrase for the first time in your life and you immediately realize how you have been missing this from your language for 30 years?

    This is one of such phrases:

    "comfort of my command line".

    --
    I do not believe in karma. "Funny"=-6. Do good and forbid evil. Yours, Oft-Offtopic Flamebaiting Troll.
  19. We've been able to render 3D in command-line by TheOuterLinux · · Score: 1

    Its called Blender, though it's "Python" and not "BASH." Matter of fact, a most of Linux programs have a headless mode. https://docs.blender.org/manua....

    1. Re:We've been able to render 3D in command-line by Anonymous Coward · · Score: 0

      ehh... and...
      povray
      renderman etc etc etc...

      but this is oldschool ogl bindings in sh.. so not the same.. i like it... nice for quick visualisations on csv's or other data ( size of free disk space etc... )

  20. Re:One more reason not to use bash by Anonymous Coward · · Score: 0

    I prefer something more modern, like fish. ksh and zsh are ancient, obsolete garbage.

  21. Might Have A Use For This by friedmud · · Score: 1

    I might actually have a use for this. I'm part of a team developing scientific simulation software... we work a lot at the command-line and it is handy to be able to visualize solutions/inputs quickly. We have many tools for visualization - but having something built right into the command-line _might_ be useful (huge emphasis on *might*!).

    I'll definitely check it out...

  22. Re:So finally, something better about Bash than MS by Anonymous Coward · · Score: 0

    Proof-of-concept: OpenGL in emacs window
    https://ncrmnt.org/2012/06/17/proof-of-concept-opengl-in-emacs-window/

    Not that this should surprise anyone, of course...

  23. Re:One more reason not to use bash by Anonymous Coward · · Score: 0

    fish looks extremely good - thanks!

  24. More Angry Americans by Anonymous Coward · · Score: 0

    What is this? News for nerds? I come here to read angry Americans telling other angry Americans how stupid they are. More Trump articles, please.

    1. Re:More Angry Americans by Curtman · · Score: 1

      I come here to read angry Americans telling other angry Americans how stupid they are

      It's self evident at this point.

  25. I need this by Anonymous Coward · · Score: 0

    So I can open lots of terminal windows in my virtual house!

  26. Perl's nasty. bash patch probably won't be merged by Anonymous Coward · · Score: 0

    Perl's pretty stinky. It's like 10 languages all mashed together. To write it, you only need to know one of the 10. To read it, you never know which of the many duplicate features will be required. Also, it over-relies on regular expressions for doing things that could've taken less squinting.

    Bash is more of a 4GL than a general purpose programming language. It's great at some things, and awful at others - but that's intentional. One thing about bash people often ignore: It's highly parallel on multicore systems, with a simple syntax - more so even than something like OCaml or Haskell. However, it's getting more line-noisy lately; it's not as elegant as plain old Bourne Shell was, which was remarkably similar to a Lisp variant if you think of a file's lines as being like the elements of a list.

    I doubt Chet will be merging OpenGL patches to bash anytime soon. However, a GL-based zenity would be reasonable.

  27. Re:So finally, something better about Bash than MS by Anonymous Coward · · Score: 0

    If you think this is what makes the unix shell superior to dos, you sure as hell don't know much about anything.

  28. Re:One more reason not to use bash by kammermusik · · Score: 1

    I don't know fish but judging from what I've read here (https://www.slant.co/versus/523/1602/~zsh_vs_fish) I'm not convinced. The only benefit over zsh I really find good is a (supposedly) good default config. But I've configured zsh years ago and I'm still using that very efficient configuration today. That's what I call return of investment. Yes, it is not 100% intuitive to configure zsh but it's got a helpful community. I've even written my own completion extensions, so how hard can it be?

    Calling zsh obsolete garbage implies you have not really used it.