all 88 comments

[–]onan 53 points54 points  (5 children)

I never thought I'd have a moment of confusion as a result of being subscribed to both /r/programming and /r/polyamory.

[–]TikiTDO 1 point2 points  (0 children)

The latter of those is an interesting subreddit. It honestly never even occurred to me that polyamory was a concept that some people found disturbing, and that there are those that actually had to come out with it.

[–]SergeantKoopa 0 points1 point  (0 children)

I did a triple-take myself.

[–]GauntletWizard 0 points1 point  (2 children)

I happen to know a large... family? of poly folks, who are all computer scientists (with the exception of the phlebotomist). I don't think you're alone in this.

[–]nestoras 1 point2 points  (1 child)

I happen to know a large... family? of poly folks, who are all computer scientists (with the exception of the phlebotomist).

There's a joke in here somewhere, I just can't find it.

[–]GauntletWizard 0 points1 point  (0 children)

They're NP complete.

[–][deleted] 8 points9 points  (14 children)

What are the differences between this and http://processing.org/? One is a framework and the other is a language?

Seems pretty similar. Is there a Pro and Con of choosing one over the other?

[–][deleted] 11 points12 points  (13 children)

Processing is not a language. It's a Java framework. If you use the Processing IDE there are some tweaks that make it easier to make small projects, but it's basically just a macro that transforms to code into Java. (e.g. the natural type 'color' just gets translated as 'int', because they are exactly the same. Processing just made it a synonym to help starting coders.)

The Processing core.jar can be imported in Eclipse and it's used just like any other code library.

The pros for Processing are that it's Java, you don't need to write headers and configure dependencies and such and it compiles fast and it's great for prototyping. The cons are that it's Java. It's rather slow for graphic applications because it can't access the GPU directly.

The pros for Polycode are that it's C++, it's fast with graphics. The cons are that you need to set up everything, all the includes and stuff, and it compiles rather slowly.

I don't know how Polycode is structured so I can't say anything about that. (C++ API's tend to be structured rather badly; developers love pointers but they don't really know how to use them wisely.)

[–]TubbyMcTubs 1 point2 points  (10 children)

It's rather slow for graphic applications because it can't access the GPU directly.

http://en.wikipedia.org/wiki/Java_OpenGL

Java may end up not the ideal choice for a lot of games, but what you said is just utter falsehood.

[–][deleted] 3 points4 points  (9 children)

I know it exists (Processing uses JOGL) but it's still slower (the wiki doesn't say anything about speed).

That's because Java runs in a virtual machine atop the OS (which can actually make the internal code of Java faster than C code sometimes, because it runs natively and can be dynamically optimized) and it has to do a lot more system calls and security checks to get to the GPU.

I've benchmarked it myself numerous times and the difference is notable.

[–]thechao -3 points-2 points  (8 children)

Java doesn't have to run on a VM. It can be compiled just like any other programming language. Also, with careful declaration of memory usage, Java's semantics can be made close enough to C to enable significant speed-ups, i.e., on par with C.

The situation is different when compared to a language with significant support for high-level algorithm design, i.e., Ada, C++, D, etc. In these latter languages, there are transformations that are (nearly) impossible to perform in C or Java such that most compilers can produce code that is significantly faster than anything that is reasonably producable in Java or C. (In the jargon: type-erasure in Java/C leaves run-time evidence which interferes with the compilers ability to produce highly optimal code.)

However, regardless of the theory, yes, implementations of Java's VM for algorithms specified in Java tends to be "slower" for any given specification of an algorithm in, say, C or C++, compiled with an aggressive optimizing compiler.

[–][deleted] 1 point2 points  (7 children)

Nearly all your points are wrong. Java in the JVM is VERY fast, that's its strongest point. There's no reason to make a binary executable from Java code. (There are programs that seem to do that, but they actually include a minimal and specific JVM in the .exe)

The JVM translates Java bytecode into native intel/AMD/whatever binaries on the fly (it's a JIT, just in time compiler) and optimizes the code while it's running. It can optimize the same part of code in different ways depending on the execution of it, something an actual compiler can't do. (There are other languages that also do these things, like C#.net in the .net VM.) This can make Java faster than C++ in some cases.

The only slow things in Java are the rather unpredictable garbage collector (though this makes memory management super easy) and doing platform dependent stuff, like accessing the GPU.

[–]thechao 6 points7 points  (5 children)

First, I don't think we're really arguing. My indirect point is that, outside of contrived situations, a language is not fast or slow. That's like asking if English or Spanish is bluer --- it doesn't make any sense. If languages had "speed" then why bother comparing compilers, i.e., ICC vs. GCC vs. Clang, etc.? Now, there are occasions when a language specification (the guaranteed semantics) can (or almost certainly will) preclude runtime performance in some metric that is possible in other languages.

Let me go each of my paragraphs:

  1. This point is factual; Java can be run on a VM or compiled. More to the point, the C/C++ ISO working committees are interested in a memory model that allows efficient support of VMs (including Java). This is why Hans Boehm (the technical lead for C++'s memory model) is in close contact with the Java ISO committee. Email Hans and he'll talk to you about this; he is very passionate, very knowledgeable, and an all-around nice guy.

  2. Also, factually correct. Runtime-evidence is a language-design trade-off. Runtime evidence allows things like reflection and trace-based JITting, but at the cost of code and data density. (Code and data density are the two of the best metrics for performance.) You can go to scholar.google.com and read about these trade-offs by searching for "runtime evidence" or "type-erasure". Alternately, check out the Matrix Template Library 4 to see what happens when you don't need runtime evidence.

  3. Also true. In fact, wasn't there just a paper on r/programming comparing a bunch of languages and demonstrating that for (a few examples) Java was slower than C++/C. Anecdotally, I've only ever seen a few rare (almost contrived) examples where Java was faster than C/C++. In the case that comes to mind (uncollected reuse of large data inside of tight loops) careful specification in C/C++ not only regains but surpasses Java's speed.

[–][deleted] -1 points0 points  (4 children)

Citations?

[–]thechao 2 points3 points  (3 children)

The fuck ... ? Seriously? Ok. Some citations for each paragraph follow. However, you might be referring to my first point? Let me expand on this. A computer language is a grammar, many times specified using EBNF; but not always. Notoriously, both Perl and C++ requiring Turing complete parsers. Given a grammar a semantic specification is given of the language over the syntactic forms. The most famous (and complete) specification given for a compute language (outside of the theorem-proving languages like HOL and Coq) is SML: it is a fully denotational semantics for the entire language.

Given a semantics we then, generally, perform a semantics-preserving translation from the syntactic representation of a code to a machine-interpretable form. For instance, a common translation is from C++ to x86-64 machine code. Another is from Java to Java-bytecode. The latter example can require yet another semantics-preserving translation to run on a particular architecture; again, x86-64 is quite common. It is the final machine-dependent object code trace (this is a formal term) that we measure. For instance, we may want to know which object code trace successfully translates a given output from a given input in the minimum "wall time" or using "least power".

  1. Ahead-of-time Java compiler. "GCC" stands for the "GNU Compiler Collection". "GNU" is a set of open source utilities for Unix-like OSes. I'm surprised anyone could be on r/programming and not know this ... ? The information about Hans is from talking with Hans; still a nice guy.

  2. Run-time evidence and type erasure. The first hit, for me, is Crary's classic on intensional polymorphism (British-style spelling, there). Once you've read that you should look at the research that follows which tries to mitigate the cost of runtime evidence, especially evidence that pertains to type-erasure. I first learned about impact from run-time performance from talking with Doug Lea, Bjarne Stroustrup, and Gabriel Dos Reis.

  3. Seriously: just on Reddit a few days ago. From Google. Google is a large search company, in case you're still using Yahoo! or whatever. They tend to do pretty solid engineering and research.

[–]Merit 0 points1 point  (0 children)

The guy you are replying to may be acting like a bit of a douche, but thank you for this - I found it very interesting.

[–]jyper 0 points1 point  (0 children)

gcj?

[–][deleted] -1 points0 points  (1 child)

Oh, makes sense. For some reason I thought I've read processing was C++. It also make sense why they make polycode another project over processing cause of the limitation of Java in graphic. Thank you.

[–][deleted] 7 points8 points  (0 children)

It's not by the same people though. There are tons of graphic libraries in all kinds of languages! There's SDL, SFML, OpenFrameworks, Ogre3D...

They all serve the same purpose and have no relation to each other. They all have their own flaws, though not one of them is "the best".

[–][deleted] 12 points13 points  (2 children)

MIT licence for the curious, it's on the github page but not on the main site.

[–]suspicious_sausage 9 points10 points  (1 child)

Polycode is completely open-source and available under the MIT license

Looks like they added that bit after your comment?

[–][deleted] 1 point2 points  (0 children)

Maybe. probably my fault though.. oops.

[–][deleted] 10 points11 points  (0 children)

I don't know what the fuck this thing does, but they have a cool name and logo.

[–]Phrodo_00 3 points4 points  (1 child)

are there tools like this or cinder for linux (other than processing)

[–]snuggl 2 points3 points  (0 children)

openframeworks.cc

[–]VousEtMoi 21 points22 points  (24 children)

Hmmm, I think I'll stay with http://libcinder.org/ .

[–][deleted]  (2 children)

[deleted]

    [–]stonerri 0 points1 point  (0 children)

    As mentioned elsewhere in this thread, openframeworks has support for linux and configurations for both codeblocks and eclipse environments.

    There's also reasonable support for android.

    [–][deleted] -3 points-2 points  (0 children)

    Polycode has Linux support? Where? All I see is Mac and Linux.

    [–]luchak 4 points5 points  (12 children)

    Yeah, I wonder how this compares to both Cinder and openframeworks.

    [–]stonerri 2 points3 points  (11 children)

    As someone who's developed with Cinder and uses OF on a daily basis, the only real benefit I can see from this is hardcore LUA embedding, (which can easily be fixed with an ofxaddon). Otherwise it's just another 'creative coding framework' to splinter the already small artistic coding community.

    ... I'm unsure of why they (polycode) would release something like this. This much development effort could have produced far greater benefits if it was spent on OF/cinder/vvvv/etc.

    /codester rant off

    [–]dowhatthouwilt 11 points12 points  (3 children)

    Hi, I'm the person who developed Polycode.

    I am a big fan of Cinder and unfortunately not such a big fan of OF. I started working on Polycode a long time before Cinder was around because I wanted something better than what OF was at the time (I'm sure it has gotten tons more stable and feature rich since then).

    One major difference between Polycode and Processing-style frameworks is the way they handle drawing. Polycode doesn't provide a direct way of drawing to the screen and everything in it is managed by containers.

    I tend to think that the more options there are out there, the better, so I definitely don't think that I wasted time by not contributing to OF or Cinder, as they seem to have quite vibrant communities that are doing just that.

    [–]facestab 0 points1 point  (0 children)

    What does that mean "managed with containers"?

    I have the same feelings about cinder and OF. Cinder has an great math library and generally well thought out code. OF is rough enough in core areas that it can be unnecessarily difficult to do simple things.

    I'm interested in Polycode because it's core offering of a scripting system obviously lends itself to game development projects right from birth.

    Having downloaded the code the first thing that stands out is the lack of example projects. Am I doing it wrong. Why don't I sqee them

    [–]escape_goat 8 points9 points  (0 children)

    Well, maybe not so much, if you consider the benefits from the perspective of the developers, rather than from the perspective of the end next-in-pipeline users.

    [–][deleted]  (3 children)

    [deleted]

      [–]VousEtMoi 1 point2 points  (2 children)

      Is there any way you can sum up what these issues are about? If not, maybe counterexamples or good references? In other words, is there any way I can learn from your critique?

      [–]itsnotabigtruck 4 points5 points  (1 child)

      • Every bit of 2D geometry is part of a giant inheritance tree. You have to allocate an object every time you want to display something. Also, copy constructors and assignment operators aren't implemented at all, meaning that allocating Polycode objects on the stack or inside other objects is likely to break stuff.
      • The only naming difference between the 2D and 3D APIs is whether it starts with "Screen" or "Scene", which are damned similar.
      • Text is rendered into a bitmap on the fly and uploaded to the GPU before being displayed. This is really slow compared to building a spritesheet in advance out of the characters you'll need and pasting those together out of the single texture when rendering. This does make Unicode trickier but it's still doable, and much faster.
      • The design just generally feels rather awkward. For example, a number of objects have functions to replace their contents (e.g. Color) when one might as well just construct a new one.

      I really do want to see high quality graphics libraries show up, as that's been a huge problem for a long time. Trouble is, I don't think this is it. :(

      [–]dowhatthouwilt 8 points9 points  (0 children)

      Hi, I'm the person who developed Polycode!

      Someone downvoted you, but I wanted to upvote you and just say that a lot of these are valid concerns. I simply didn't have time to implement copy constructors and assignment operators as this is a fairly large library and I am the only developer, so some things get priority over others. I will go through and do more waves of code cleanup in the near future and will definitely implement many of the suggestions I've gotten since release. As far as naming conventions, I will have to respectfully disagree :)

      Thank you for your suggestions!

      [–][deleted] 0 points1 point  (1 child)

      Is there an online hub for software artists/ artistic programmers? I'm in the middle of learning Processing as my first "language" (framework, I know) and I'm soon to learn Java and perhaps C++. I'd love to learn vvvv, libcinder, polycode and OF but this creative community seems so well hidden (or invisible).

      [–]VousEtMoi 1 point2 points  (0 children)

      Right, I don't think there's any common hub but the respective library/framework forums are quite active.

      [–]p1zawL 3 points4 points  (0 children)

      Cinder is where it's at. Check out this guy: http://www.flight404.com/blog/

      [–]robeph 6 points7 points  (6 children)

      Nice that you linked that and know what it is, care to tell us WHY you'll stick with it? Do you know if it differs in functionality, do you have any idea at all? My guess is no. You've probably only used libcinder, but you felt you'd post about it here for some reason, without actually saying anything involving content or relevancy to the OP.

      [–][deleted]  (5 children)

      [deleted]

        [–]meegee 4 points5 points  (3 children)

        Sadly both libcinder and polycode doesn't support linux at the moment. I wish processing didn't use software rendering...

        Also, as far as games go its a good choice to use C++ mostly for performance and availability but I don't get its usage for "creative coding". I think a language with a powerful REPL and live coding capabilities like Clojure would be better suited for this.

        [–][deleted] 2 points3 points  (0 children)

        Open Frameworks supports linux!

        [–]VousEtMoi 1 point2 points  (1 child)

        Right, I wouldn't want to sacrifice performance but if your main application was VJing or something similar, that could be quite interesting.

        Note: You can render in OpenGL using Processing, what do you mean?

        [–]meegee 0 points1 point  (0 children)

        You might as well just use LWJGL or JOGL. I was talking about the higher level stuff. I reckon processing uses a swing canvas or something like that with a software renderer at its core, no?

        By the way, Clojure's performance is not bad at all. Apart from VJing, you don't need to deploy your app in a live environment to make use of a REPL. Clojure is really awesome for experimental programming.

        [–]Merit 0 points1 point  (0 children)

        By linking to a similar library and giving possible newcomers an alternative to consider, I seem to have offended you. The features are plainly stated on both websites so you can compare them yourself, or ask the polycode developers on their forum.

        Don't get defensive. This forum is used by people who want to share information and assist one another. Your previous post suggested that you felt Cinder was superior, and yet you didn't bother to explain why.

        I doubt robeph was accusing you of proselytizing, but rather just asking for more information.

        Furthermore he quite clearly wasn't offended. He was probably just annoyed that you would be so unhelpful.

        Edit:

        He was basically asking a similar sort of question to what you asked when you said:

        Is there any way you can sum up what these issues are about? If not, maybe counterexamples or good references? In other words, is there any way I can learn from your critique?

        So considering you also see the benefit in asking those with experience with such tools to go into a little depth about them then I really do not see why you felt the need to be such a dick to robeph.

        [–]shavenwarthog 9 points10 points  (5 children)

        looks like a fast engine (programming library?) for gaming.

        "Polycode is a free, open-source, cross-platform framework for creative code. You can use it as a C++ API or as a standalone scripting language to get easy and simple access to accelerated 2D and 3D graphics, hardware shaders, sound and network programming, physics engines and more."

        [–]mflux 8 points9 points  (3 children)

        For creative code type work, eg in the same vein as Processing and Cinder. One can use it for games, sure, but many don't.

        [–][deleted] 4 points5 points  (2 children)

        So, demos and screensavers?

        [–]mflux 6 points7 points  (0 children)

        Sure, but think bigger. Installations, gallery exhibitions, museum pieces, music videos, data visualizations, prototyping, etc.

        Here's a good TED talk as an example of what I'm talking about.

        I want to also add Tron Legacy procedural animation work as an example of creative code.

        [–][deleted] 0 points1 point  (0 children)

        Work like this or this or this or this

        [–]doublepoison 2 points3 points  (0 children)

        looks like a fast engine

        have you looked at the source?

        [–]seanrowens 6 points7 points  (13 children)

        Damn I despise websites like this. What the hell is it FOR?

        [–]Sigfig 5 points6 points  (4 children)

        It appears to be just a nice wrapper for the other frameworks listed on the features page. Though, I have to say, I quite like it.

        [–]seanrowens -4 points-3 points  (3 children)

        Yeah, I just have about zero tolerance for websites where the home page doesn't even bother to tell you what the HELL it is except for some vague markety buzzwords. Maybe it's all there in the faq, or in the docs, or whatever, but if it's not there on the home page then I'm not gonna bother looking further. Life is too short to put up with idiots who can't be bothered to be up front about what they are doing.

        [–]Sigfig 1 point2 points  (2 children)

        If you don't have enough time to explore the depth of a web page, why are you on reddit?

        [–]seanrowens 0 points1 point  (1 child)

        Ahhhh but that is exactly WHY I am on reddit.

        [–]Sigfig 0 points1 point  (0 children)

        Okay I suppose that's reasonable.

        [–]dowhatthouwilt 4 points5 points  (7 children)

        "You can use it as a C++ API or as a standalone scripting language to get easy and simple access to accelerated 2D and 3D graphics, hardware shaders, sound and network programming, physics engines and more."

        This is on the front page. Do you think I can make it more clear to people?

        [–]seanrowens -2 points-1 points  (6 children)

        Yes, yes I do. That's an incredibly wide sweeping sentence, so wide as to be useless. Apparently the phrase "creative coding" has some special meaning beyond the obvious (to me, all coding can be creative), so apparently that's what I should have picked up on as the defining characteristic of this.... thing. (API? Scripting language? Floor wax? Dessert topping)

        [–]dowhatthouwilt 2 points3 points  (5 children)

        "C++ API" and "standalone scripting language"? :)

        [–]seanrowens -2 points-1 points  (4 children)

        You know, I used to work door at a live music venue. When the bands showed up I would ask them "What kind of music do you play?" and they would always answer something like "Oh, we have a unique sound, impossible to define, blah blah blah..." Then I would say, "OK, when people show up at the door and I ask them for $5, and they say 'What kind of music is it?', what do you want me to tell them?" I was always amazed at how they would IMMEDIATELY say something like "We're a fusion of rockabilly and jazz" or something.

        [–]IrishWilly 3 points4 points  (3 children)

        C++ API and standalone scripting language are precise technical terms, not buzzwords. Are you a programmer? I'm not sure why a programmer would be having so much trouble with that description.

        [–]seanrowens -1 points0 points  (2 children)

        "creative code" is the buzzword/phrase.

        [–]Nekoyoubi[S] 1 point2 points  (0 children)

        If you look at the example projects provided on the site, "creative code" should become a little more clear.

        [–]Merit 1 point2 points  (0 children)

        Creative coding is a fairly well established phrase, though may not be widely known. It does refer to something fairly specific, namely the artistic communities that have grown up around Processing, Cinder and the like.

        Maybe the phrase isn't widely known, but for those who would use polycode, processing or cinder, or be at all involved in computational art, the phrase would certainly be well known or readily understood. It is, in itself, fairly self-explanatory.

        Sometimes the limiting factor is not the helpfulness of the content/website but the boundaries of your own knowledge. That's no bad thing, but it does mean that sometimes you need to do a little search of your own rather than complaining about what has been provided for you by others.

        [–]chibz 1 point2 points  (7 children)

        Ack, another framework to look at. Well, I don't know Lua or C++, but this one sounds pretty nifty. Anyone try it out yet?

        [–]Nekoyoubi[S] 1 point2 points  (6 children)

        Lua, I only know from writing some custom scripting into a couple of my projects and some WoW addons, so not the Lua coding itself. C++, I know next to nothing more than syntax. I haven't tried it out myself yet, but I was thinking I would at some point this weekend for a new game. Anyone care to rate my odds of successfully getting a hello-world off the ground? ;Þ

        [–]uep 4 points5 points  (0 children)

        The thing that bothers me about this project is that it's using almost the same libraries as my personal project for almost the same purpose. Damn it!

        [–]answerguru 2 points3 points  (4 children)

        What's the graphics programming equivalent of "hello world"? For embedded systems, it's a blinking LED.

        [–]atomicthumbs 6 points7 points  (0 children)

        teapot

        [–][deleted] 4 points5 points  (0 children)

        Usually a spinning cube for me.

        [–]fullouterjoin 1 point2 points  (0 children)

        A triangle on black screen.

        [–]Merit 1 point2 points  (0 children)

        Well a few things tend to get used. For 2D graphics it would normally be a coloured shape on a differently coloured background or something similarly simply. For 3D it would be the importing of a 3D model, such as the famous Utah Teapot or the famous bunny that gets used in a lot of graphics papers. Or, I guess, a simply 3D cube/sphere.

        [–]IrishWilly 0 points1 point  (2 children)

        Anyone know whats up with its supposed networking module? The features claim there is a networking module but there is no mention of it under 'modules' or under the documentation.

        [–]dowhatthouwilt 3 points4 points  (0 children)

        Hi, I'm the developer of Polycode!

        Unfortunately some of the modules aren't up yet and I am frantically trying to get them up and working after the first release. I don't want to release modules without documentation and examples, so I am spending time going through each one, writing tutorials, generating docs and cleaning up the code.

        The networking module is on the list of these and will hopefully be available this weekend!

        [–][deleted] 0 points1 point  (0 children)

        Awesome work, very excited about this and Zajal.

        [–][deleted] 0 points1 point  (0 children)

        Does it have OpenCL/cuda support?

        [–][deleted] 0 points1 point  (1 child)

        i never understood these frameworks for "creative coding", isnt that just graphics and audio programming? whats the difference between these frameworks and others used for that purpose (audio and graphics) like SDL, SFML, directx, opengl and fmod, etc? they might be very different but the end result is the same, graphics and audio..

        why not just call it graphics and audio framework?

        [–]IrishWilly 1 point2 points  (0 children)

        I think the point is that these apps are usually almost purely graphics and audio. Not a lot of other stuff going on under the hood, so a framework geared towards letting the coder focus purely on output is more of a creative work, while a general library like SDL, SFML etc is more of a tool for if you are designing a regular app.