Slashdot Mirror


OpenGL in PHP

Neophytus writes "Submitted as an entry into the .geek PHP5 tournament a proof of concept openGL implementation in PHP has been released by Peter 'iridium' Waller. The demonstration (download) shows four items being rendered in realtime by PHP at a not unreasonable 59FPS. The author welcomes feedback with practical uses for this technology." Update: 06/09 01:10 GMT by T : iridiumz0r, author of this entry, adds a link to this informative page responding to a number of comments in the discussion below.

32 of 286 comments (clear)

  1. PHP OpenGL on SourceForge by mdrejhon · · Score: 5, Interesting

    Very impressive -- A while back I heard about PHPOpenGL.

    But he didn't even use this at all! Pretty self contained, even to the gzipped uuencoded DLL file embedded in this PHP script whose sole purpose is to create the window that this PHP demo needs for the 3D graphics.

    1. Re:PHP OpenGL on SourceForge by abscondment · · Score: 5, Funny

      This just in:

      Ken Brown of AdTI reports that there's no way this code could have been written in one year. More investigations are planned to see if code was stolen from MINIX.

    2. Re:PHP OpenGL on SourceForge by iridiumz0r · · Score: 5, Informative

      I'm the author of this thing. I read slashdot quite regularly and I'm very suprised this found it's way here. In my opinion it is not slashdot worthy. It relies on lots of experimental stuff, and is just generally not up to production standard. It was my mess-around one afternoon when I should have been studying. I entered it into the competition because I wanted to do something different. I chose intentionally not to use PHP-GTK for various reasons. I wanted to start out from scratch and see if I can do everything myself. It was not my intention to do this all 'properly' as such.

    3. Re:PHP OpenGL on SourceForge by typobox43 · · Score: 4, Funny

      You obviously don't read Slashdot as regularly as you say if you think that a "mess-around" wouldn't make it onto the front page.

    4. Re:PHP OpenGL on SourceForge by iridiumz0r · · Score: 5, Interesting

      I didn't think anyone would submit it. I didn't. But, I suppose I'm not suprised it reached it if someone were to submit it.

    5. Re:PHP OpenGL on SourceForge by The+Ogre · · Score: 5, Funny

      Please, "not slashdot worthy"? I believe the page that details how to make an Enterprise out of a dead floppy disk made it up here, twice. You got that *BEAT*.

  2. Running This by andyrut · · Score: 4, Informative

    I'm sure others are thinking, like me, "Huh? PHP in a window, not a server-side script?" It took me a couple of moments to figure out how this works, so I figured this could be of some help to others struggling with it.

    How to get this download to work in Windows:

    1. Unzip the contents of the download to C:\php5
    2. Open the C:\php5 directory in Windows Explorer
    3. Drag and drop the opengl.php file onto the php-win.exe icon

    or

    2. Open a Command Prompt
    3. C:
    4. cd \php5
    5. php-win.exe opengl.php

    It seemed to me that the DLL paths are hard-coded, so that's why it needs to be in that particular directory.

    1. Re:Running This by rat7307 · · Score: 4, Funny

      I'm sure others are thinking, like me, "Huh? PHP in a window, not a server-side script?"

      PHP-GTK baby.... GTK apps written in php..

      Soon php will be used for all kinds of innapropriate uses!!

      Viva PHP!

      --
      Burma?
    2. Re:Running This by PCM2 · · Score: 5, Funny
      Soon php will be used for all kinds of innapropriate uses!!
      Like programming, you mean?

      OOooooooh, FACE!!

      --
      Breakfast served all day!
    3. Re:Running This by jdray · · Score: 4, Funny

      Let me get this straight...

      1. Read story on Slashdot.
      2. Download .zip file to Windows box.
      3. Unzip file.
      4. Execute unknown code.
      5. ????
      6. Pray.

      Is that about it?

      --
      The Spoon
      Updated 6/28/2011
  3. Using the right tool for the job by Cardinal · · Score: 5, Insightful

    ...Is truly a lost art.

    Of course, we already knew this.

    1. Re:Using the right tool for the job by chabotc · · Score: 4, Funny

      When you have a hammer, everything looks like a nail!

    2. Re:Using the right tool for the job by killjoe · · Score: 4, Interesting

      I am curious, why don't you consider php to be the right tool? It's a turing complete language, it's object oriented, it supports inheritance (and mixin type multiple inheritance), it has exception handling, assertions, a large library and a large community.

      So why not php? What makes php a poor choice as opposed to say perl, python, ruby, vb.net or any other scripted language?

      --
      evil is as evil does
    3. Re:Using the right tool for the job by Saeed+al-Sahaf · · Score: 4, Insightful
      So why not php?

      Because you don't have to be a "guru" a la Perl to right functional programs with it. Same reason people here hate VB.

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    4. Re:Using the right tool for the job by pizza_milkshake · · Score: 4, Insightful
      It's a turing complete language

      so is Brainfuck, but i wouldn't consider it the right tool at any time.

    5. Re:Using the right tool for the job by runderwo · · Score: 4, Insightful
      Nice troll. The problem is more like that with PHP you can "right" programs that work with a minimum of effort. That sounds great, but the issue shows up when that code is handed to someone else. Debugging someone else's code in a language that enforces structured programming pragmas as little as possible is a nightmare. I know this because I do it on a regular basis.

      PHP is like MySQL, and it appeals to the same group of people. It works, most of the time. When it's not sure what to do, it does _something_ rather than annoy the programmer, which might even be the wrong thing. When it does something that might be the wrong thing, it does it silently whenever possible so there is no "squeaking" on the outside. The result is that PHP programs work most of the time, like MySQL. That sounds great, but they also have a tendency to fail in unexpected murky ways.

      BTW, there is no need to be a "guru" to write Perl programs. An understanding of the syntax, as well as basic structured programming/OO principles is all that is necessary to create fast, reusable, and reliable Perl code. The problem is that frequently people lack the latter, so they jump on a language like PHP which lets them get away with not having to know such things. Such people view PHP as superior and Perl programmers as pretentious language snobs because they can do in 5 minutes in PHP what would have taken them an hour to learn how to do in Perl. That in no way invalidates the viewpoint of the Perl snob. PHP is a half-ass hack of a language that happens to be preferred by the majority of half-ass hacks of programmers out there.

      Note, this is not a flame at PHP developers. I know some really good ones. I'm flaming people who suggest that PHP is a better language because it doesn't make you learn anything about software design principles. That's precisely the reason I avoid other people's PHP code whenever possible and don't recommend its use in a business environment where software infrastructure quality counts towards the bottom line.

  4. Practical uses for this technology by vxvxvxvx · · Score: 5, Funny

    Opengl in php.. well, let's see, you could umm.. sell it to a PHB who doesn't know any better, or make bets with people at the local pub that it can be done and then whip it out to win the bet.

    1. Re:Practical uses for this technology by Doomrat · · Score: 5, Funny

      Opengl in php.. well, let's see, you could umm.. sell it to a PHB who doesn't know any better, or make bets with people at the local pub that it can be done and then whip it out to win the bet.

      You'd have to find a pub full of freaks first, though.

  5. vsync by shamilton · · Score: 4, Interesting

    59 fps? Sounds like vertical sync at 60 hz. Anybody have any real performance figures?

    --
    "[A] high IQ is like a Jeep; you will still get stuck, just farther from help!" --Just d' FAQs, c.g.a
  6. Correct me if I'm wrong, but... by Anonymous Coward · · Score: 5, Informative

    This actually isn't an "OpenGL implementation". It just calls OpenGL func in win32 environment.

  7. Do not be fooled by this by Anonymous Coward · · Score: 4, Funny

    cheap implementation. JBoss have a far superior product and this does not even come close to the technical excellence that is JBoss. I do not work for JBoss.

  8. Hrm.. by Anonymous Coward · · Score: 5, Funny

    Maybe I'll just start using my kitchen sink as a bathtub just because I can.

  9. Rendering 3D graphs of a slashdotting by mhesseltine · · Score: 4, Interesting

    While my subject is half-joking, it would be cool to be able to have a running traffic chart generated by a PHP script that you could use to monitor a particular server.

    Maybe tie this in with the 3D portscanning/IDS system mentioned a few days ago and make it a remote application?

    --
    Overrated / Underrated : Moderation :: Anonymous Coward : Posting
  10. Re:Practical use by shamilton · · Score: 4, Informative

    You are way off. This is pure novelty and has nothing to do with "server side" or "web pages," don't be fooled by the presence of PHP. Also, "port of OpenGL" doesn't make much sense -- OpenGL cannot be ported, just implemented, which this does not do. It's just an OpenGL client.

    --
    "[A] high IQ is like a Jeep; you will still get stuck, just farther from help!" --Just d' FAQs, c.g.a
  11. Perfect application by Capt'n+Hector · · Score: 5, Interesting

    I've joined a group at LBNL (berkeley lab) that could use this. They have a database of molecular data, and they need a way to visualize it using a web interface.

    --
    Quid festinatio swallonis est aetherfuga inonusti?
    Africus aut Europaeus?
  12. Two words... by tickticker · · Score: 4, Funny

    ...better pr0n

    --
    This sig doesn't do windows

  13. This is NOT Server-side by cbrocious · · Score: 5, Informative

    Just from reading a few comments, I see people still believe PHP is only server-side. This is all client-side. No server is neccesary. This is just like php-gtk, and the old php_opengl implimentation.

    --
    Disconnect and self-destruct, one bullet at a time.
  14. How about a new set off 'On Demand' products? by randomErr · · Score: 4, Interesting

    Here's a couple of ideas:
    - GPS terrain mapping: stream a live map in real time with low bandwidth
    - Shrek Chat Live!: Have hires avatars render while you speak. Kinda like that Microsoft chat but with good chat buddies.
    - Quantum Encryption: Have a whole 3d movie but just use three texture map hidden in the movie are your keys.

    --
    You say things that offend me and I can deal with it. Can you?
  15. Re:Mod parent down. by ultramk · · Score: 4, Funny

    ... and I doubt they would make it to the front page on Slashdot without someone actually downloading and running them to see what they are.

    Hi, welcome to Slashdot. You must be new here.

    m-

    --
    You catch enchiladas by picking them up behind the head and holding them underwater until they don't kick anymore -VeGas
  16. uh, you read that wrong by theantix · · Score: 4, Funny

    from the they-said-it-couldn't-be-done dept.

    No, that was the "from the they-said-it-shouldn't-be-done dept." It's down the hall to the right, and be sure to knock loudly before entering.

    --
    501 Not Implemented
  17. awesome by vmircea · · Score: 4, Informative

    This is a very cool thing heh.. but it isn't to be unexpected, as phpopengl was already made, but this new one looks great as well. But who knows what other things will come out... Look at all of these things that php can do here ,there are a bunch of interesting and very useful mods, and more come out all the time. Also, take a look at that link, it gives you a good idea of what php can do (although there is much more than what is on that page).

  18. Not an implementation, but a binding by Xeger · · Score: 4, Informative

    Alert and knowledgeable readers will note that this isn't an implementation of OpenGL, but a binding of the OpenGL API into the PHP language.

    A PHP *implementation* of OpenGL would be very impressive, indeed! That would imply that all of the 3D math, texture mapping, shading, rasterization, etc was written in OpenGL. Unfortunately, such an implementation would probably be extremely slow and therefore fairly useless. And it would of course still require an dynamically linked C library for framebuffer access.

    So -- this is a cute trick, to be sure, but nothing to write home about. The author of the software has already said as much in an earlier comment.