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.

286 comments

  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 Rodrin · · Score: 1

      Hah. Thats got to be it! It's stolen from Minix! Lets get together and write a book about this dirty theif. HAH.

    3. 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.

    4. 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.

    5. 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.

    6. 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*.

    7. Re:PHP OpenGL on SourceForge by Profane+MuthaFucka · · Score: 3, Funny

      I would have been the author of this thing, but I read Slashdot too fucking much.

      --
      Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
    8. Re:PHP OpenGL on SourceForge by pcmanjon · · Score: 2, Insightful

      I don't know what submitter of story's problem is with his computer only getting "59FPS." but I seem to get 120. Weird.

    9. Re:PHP OpenGL on SourceForge by Erratio · · Score: 1

      And I suppose you have the exact same computer as him?

      --
      I don't try to be right, I just try to make people think
  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 rffmna · · Score: 2, Insightful
      Thanks for instruction.

      I get ~113 frames per second...double the "official" number.

      I also wonder what the FPS depends more on..CPU, to interpret the PHP, or graphic card, to render textures...hum..

      --
      -------
      FM Clan
    4. Re:Running This by Fweeky · · Score: 2, Interesting

      Some would say that any use is inappropriate for PHP. Not me, but it's certainly one of the less interesting open source languages about.

      For instance, Ruby's web application support has been rapidly gaining ground for quite a while now; fancy state-keeping systems last seen on LISP; a powerful server framework now integrated with the standard library; an innovative object-relational mapping library which makes interfacing with SQL databases childsplay; an interesting new web application framework which is causing quite a stir; an amazingly easy to set up Wiki server; a nifty template library gaining fancy bytecode based acceleration and native-C compilation. Every one of these projects alone is probably more interesting to the average developer than yet-another-OpenGL-module for an interpreted language... isn't it?

      Maybe this is why this is News for Nerds, not News for Geeks ;)

    5. 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
    6. Re:Running This by no+longer+myself · · Score: 3, Funny

      It couldn't be anymore dangerous than checking your e-mail in Outlook...

    7. Re:Running This by YOU+LIKEWISE+FAIL+IT · · Score: 1

      Not really. All that stuff sounds suspiciously like "dayjob". But PHP spawning a window via an encoded dll for OpenGL? Now that's entertainment.

      --
      One god, one market, one truth, one consumer.
    8. Re:Running This by jdray · · Score: 1

      Yeah, well I don't do that either. :^)

      --
      The Spoon
      Updated 6/28/2011
    9. Re:Running This by Fletch · · Score: 2, Informative
      It seemed to me that the DLL paths are hard-coded, so that's why it needs to be in that particular directory.
      The PHP binary is looking for the php_ffi.dll extension in it's default extension_dir (C:\php5\ext). Instead of unzipping it there you could simply run it as:
      php.exe -d extension_dir=. opengl.php
    10. Re:Running This by Anonymous Coward · · Score: 0

      I love your nick, Fweeky!

    11. Re:Running This by yerfatma · · Score: 2, Funny

      Close one eye.

    12. Re:Running This by Anonymous Coward · · Score: 0

      So, how's it handle load?

      Oh yeah, nobody bothers to test that nowadays.

    13. Re:Running This by Anonymous Coward · · Score: 0

      Also, please note that if you have PHP 4 or older installed with a php.ini in c:\windows or c:\winnt, you must "hide" this php.ini file prior to starting the demo, because the php-win.exe or php.exe interpreter (coming from PHP 5) will try to load this file on startup and will choke on older extensions that might be loaded there.
      I personally renamed c:\winnt\php.ini to c:\winnt\php.ini_4 ...

    14. Re:Running This by Anonymous Coward · · Score: 0

      You of course forgot

      7. ????
      8. Profit!

      Not sure why pray is *after* 'execute unknown code'... wouldn't that be a bit late?

  3. my favorite game... by AtariMike · · Score: 3, Funny

    How soon till we see a port of Unreal?

    1. Re:my favorite game... by DarkHelmet · · Score: 3, Funny

      Right after the Duke Nukem Forever port.

      --
      /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
  4. 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 tolan-b · · Score: 2, Interesting

      php is fast has a superb set of built in functionality and very flexible, and with php5 has pretty good OO support.

      Sure you're not just prejudiced? :)

    3. 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
    4. Re:Using the right tool for the job by Jeff+DeMaagd · · Score: 1

      I don't think so. Does gtk easily do 3D? It looks to me that the demo uses 3D.

    5. Re:Using the right tool for the job by Anonvmous+Coward · · Score: 1

      "Using the right tool for the job ... Is truly a lost art."

      What? He is creating a tool.

    6. 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
    7. Re:Using the right tool for the job by damiam · · Score: 2, Informative

      GTK can embed an OpenGL display, so yes, you can use 3D in GTK apps. That wasn't, however, the parent's point. The point was that PHP was designed for server-side scripting and is therefore not the right tool for any GUI job.

      --
      It's hard to be religious when certain people are never incinerated by bolts of lightning.
    8. Re:Using the right tool for the job by Saeed+al-Sahaf · · Score: 0

      Yes, yes, checking the spelling is good. "Write".

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    9. Re:Using the right tool for the job by NoMoreNicksLeft · · Score: 1

      And when that hammer is PHP, its a styrofoam prop carved to look like a caveman's club.

    10. Re:Using the right tool for the job by Anonymous Coward · · Score: 0

      well then it has some merit in that php can attract new programmers

    11. Re:Using the right tool for the job by Saeed+al-Sahaf · · Score: 1
      well then it has some merit in that php can attract new programmers

      This is true. But it also has many proven highly complex uses, has provided the programming framework for many heavy applications. By the way, this whole story is going to turn into a giant PHP troll / flamefest.

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    12. Re:Using the right tool for the job by (eternal_software) · · Score: 1

      VB.Net, C#, or any other .Net framework language are certainly NOT scripting languages!

    13. 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.

    14. Re:Using the right tool for the job by drew · · Score: 1

      i would say that it's absolutely brain-dead scoping rules alone make it not the right tool for just about any meaningful task. and unless you're refering only to php5, calling php object oriented is like calling an old ten-speed with an electric motor strapped onto it a motorcycle.

      --
      If I don't put anything here, will anyone recognize me anymore?
    15. Re:Using the right tool for the job by FuzzyBad-Mofo · · Score: 2, Insightful

      I don't hate VB because non-coders can use it, I hate VB because it forces me to think like a non-coder in order to use it.

    16. Re:Using the right tool for the job by loginx · · Score: 3, Insightful

      And perl was designed for text processing.

      Languages evolve as more great developers join the core development teams and change the behavior and functionality of the language.

      A good language is a language that can evolve beyond what it was designed to do and scale well.

      PHP and Python are such languages.

    17. Re:Using the right tool for the job by Nasarius · · Score: 1
      So why not php? What makes php a poor choice as opposed to say perl, python, ruby, vb.net or any other scripted language?

      What makes any scripting language a good choice for 3D graphics?

      --
      LOAD "SIG",8,1
    18. Re:Using the right tool for the job by Fweeky · · Score: 0

      PHP's not OO any more so than Perl is; it has OO features, but they're rarely used, even inside the standard library. That OO is only just becoming a feaure you can use a lot of without the language creaking under all those =&'s kinda demonstrates this - OO is a PHP addon, and for the most part feels like it. Exceptions are not yet in the PHP everyone actually uses yet, either; it's hardly the right tool if you have to use prerelease software to make it work.

      The large library you mention is pretty poor, to be honest; the standard range of extensions don't really follow much in the way of guidelines, so you end up with a complete mess of functions (all polluting the global namespace; something PHP's only just discovering is a Bad Thing) following different conventions for names and arguments and return values. And all expected to be embedded directly in the executable; something which is fairly reasonable in a webserver environment, but just bloats everything else.

      Third party PHP libraries tend to be of fairly poor quality, because the community just doesn't tend towards things like clear design and unit testing (probably a factor of it being a lot of people's first programming language). There may be a lot of code for it out there, but most of it isn't of very high quality.

      The community isn't much of an attraction either; all the major languages have communities, what makes PHP's any better? That it's seemingly filled by said my-first-language peeps doesn't seem to help from my point of view (this is where speghettified monstrosities like phpNuke come from, and how they become popular).

      I once loved PHP; now I merely like it.

    19. Re:Using the right tool for the job by Jahf · · Score: 1

      I use Perl on a regular basis and am by NO means a guru.

      I've also done a fair amount of JavaScript and a bit of VBScript

      A couple of months ago I started playing with PHP. For web apps, sure, it's easier to cobble some things together than in Perl (though for a couple of bits I was seriously missing Perl lingo), but based on my experience I stongly doubt it is going to be significantly easier to write a system application (not web oriented) in PHP than it would be in any other similar language.

      Alot of it has to do with what you use most often, but I didn't feel that PHP made things that much easier than Perl.

      --
      It is more productive to voice thoughtful opinions (reply) than to judge (moderate) others.
    20. Re:Using the right tool for the job by GnuVince · · Score: 2, Insightful
      Python is fast has a superb set of built in functionality and very flexible, and has great OO support.
      Ruby is fast has a superb set of built in functionality and very flexible, and great OO support.
      Smalltalk is fast has a superb set of built in functionality and very flexible, and great OO support.
      Common Lisp is fast has a superb set of built in functionality and very flexible, and great OO support.

      Nothing about PHP makes it more suited for this job. Also, PHP is a language that was made specifically for web pages and turned into a general purpose language because of some mad scientists. On the other hand, Python, Ruby, Common Lisp and Smalltalk are all general purpose languages, and were made that way from scratch.

    21. Re:Using the right tool for the job by Anonymous Coward · · Score: 2, Interesting

      I'm a C coder, and I don't like VB.

      But personally, I don't think that it forces you to think like a non-coder. It just has a very crippled, rigid, and non-expressive syntax that gets in your way.

      If you took VB.NET and gave it a C-like syntax, it'd start to look a lot like Java, which is a pretty good language, and certainly better than nothing. The clumsiness of VB syntax, however, is what ruins the language IMHO.

      Think about it:
      Dim x as Integer
      int x;

      If...Then..End If
      if( ... ) { ... }

      Function iSomeFunctionName( x as Integer ) as Integer
      iSomeFunctionName = x
      End Function
      int fn( int x ) { return x; }

      These are all examples of equivalent statements. VB's just happen to be more clumsy, less flexible, and more bullshit-heavy. You can still do interesting things in VB. It's just annoying.

      If there's one thing VB is good at, it makes it really easy to create GUI applications, and fast. And now that VB is VB.net, VB can use C# objects, and vice versa. So, honestly? I wouldn't mind coding the core of an application in C# (or better yet, Java), and then using VB.net to create a flimsy/cheap UI connecting the pieces and making it look presentable. In fact, if done right, that could turn out to be a better way to design an application.

      Every tool has a place. Don't let the number of bad VB "programmers" fool you. Believe it or not, it's possible to create a "good" VB app.

    22. 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.

    23. Re:Using the right tool for the job by Gortbusters.org · · Score: 1

      thank god for mad scientists! YEEEEEHAH!

      --
      --------
      Free your mind.
    24. Re:Using the right tool for the job by runderwo · · Score: 1
      Man, posting on a PHP story is like posting on a BSD story: you'd best be toeing the party line, or they send some mods after you to break your legs.

    25. Re:Using the right tool for the job by name773 · · Score: 1

      i certainly hope you write in assembly

    26. Re:Using the right tool for the job by Anonymous Coward · · Score: 0

      and whats wrong with mad scientists ... there is no genius free from some tincture of madness ...

    27. Re:Using the right tool for the job by Canberra+Bob · · Score: 3, Insightful

      "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."

      Same here, and I totally agree with you. If something goes wrong, I want to know about it, not have the program / database decide for me what it should do with it. I think your problem was you mentioned something bad about MySQL in a PHP story. The LAMP zealots are amongst the worst. MySQL will accept date types like 2004-15-60! Having to support quite a number of apps, I want to know the moment something funny happens, not find out a month later when the end user is pulling a report.

      For simple web apps (eg shopping cart) I advise people to use LAMP due to its simplicity. Anything larger and I advise people to stay well clear and go with something like Java (or Perl) and Postgres. This forces the designer / developer to think in large terms to begin with. May seem like a waste of time early on (and it is if you know for certain your app will not grow) but when you start scaling up, it will save a total rewrite.

    28. Re:Using the right tool for the job by Daniel+Dvorkin · · Score: 1

      Perhaps the reason you got modded down is because your original post is a cut'n'paste troll a la "BSD Is Dying"? I've seen the same post in several other stories on PHP. If you can't come up with an original argument, please just give up.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
    29. Re:Using the right tool for the job by FLEB · · Score: 1

      Could be worse... it could be AppleScript.

      --
      Information wants to be free.
      Entertainment wants to be paid.
      You just want to be cheap.
    30. Re:Using the right tool for the job by killjoe · · Score: 1

      What's wrong with the PHP scoping rules? There is a global space, all functions have local space, class level variables have their own space. What else do you want?

      And one more time. Explain to me how the object orientation of PHP is that much different then python.

      --
      evil is as evil does
    31. Re:Using the right tool for the job by killjoe · · Score: 1

      "PHP's not OO any more so than Perl is; it has OO features, but they're rarely used, even inside the standard library. That OO is only just becoming a feaure you can use a lot of without the language creaking under all those =&'s kinda demonstrates this - OO is a PHP addon, and for the most part feels like it. Exceptions are not yet in the PHP everyone actually uses yet, either; it's hardly the right tool if you have to use prerelease software to make it work."

      What an odd bit of rambling. SO what if OO is an add on. It exists and it supports polymorphism and inheritance. It also supports mixins and is highly dynamic. Explain to me why that's not good enough, better yet explain to me why it's any different then python?

      "The large library you mention is pretty poor, to be honest;"

      Bullshit. I have used dozens of fantastic libraries. The community has been extremely helpful and the online documentation is awsome.

      Apparently you have some sort of a chip up your ass about PHP but none of what you have said here as any merit. You saying "php suxors, php developers are lam3rs" is not going to change anybodies minds.

      --
      evil is as evil does
    32. Re:Using the right tool for the job by DMUTPeregrine · · Score: 2, Funny

      Everything you just said can be applied to INTERCAL. It's turing complete. It's object oriented. Normally the object being a sledgehammer taken to the inventors, but still an object. It supports inheritance. Thousands have inherited headaches from trying to comprehend it. It has exception handling. The language is an exception, and it can handle printing the word INTERCAL rather without all That much difficulty. Assertions. Very easy in intercal. A large library. Well, there are a good number of libraries. Large community: Well, it's a good size, and anyone who has ever obfuscated code is an INTERCAL user at heart. Also anyone sick of the establishment. So why not INTERCAL? What makes INTERCAL a poor choice as opposed to say perl, python, ruby, vb.net, or any other language whatsoever?

      --
      Not a sentence!
    33. Re:Using the right tool for the job by Doctor+O · · Score: 1
      The community has been extremely helpful and the online documentation is awsome.

      Yeah. Like the extremely useful documentation of the DOMXML functions. I mean, XML is so strange no one will ever use it anyway, right? The expat-based XML functions are even worse - there is at least some info, but the examples completely fail to show WTF one is supposed to do with those. Google knew the answers, but a good documentation should make googling mostly obsolete.

      --
      Who is General Failure and why is he reading my hard disk?
    34. Re:Using the right tool for the job by AaronLawrence · · Score: 1

      Maybe VB.NET is good for GUIs. But VB6 was long ago surpassed by Delphi and probably others. It's more than annoying, it's barely functional IMHO. For nearly anything useful you have to use API calls, which is a sign of poor design.

      --
      For every expert, there is an equal and opposite expert. - Arthur C. Clarke
    35. Re:Using the right tool for the job by Anonymous Coward · · Score: 0

      He put it in speech marks for a reason

    36. Re:Using the right tool for the job by Fweeky · · Score: 1

      I'm not trying to change anyone's mind; just chipping in with my opinion as a developer who's used PHP quite a lot. I think you'll find a fair few people agree with my assessment too; probably not the majority, but since when has the majority known anything?

      I was going to write a detailed reply, but I doubt many people would appreciate it; once being a very enthusiastic PHP user means I can appreciate your position. I just feel I've outgrown the language; the documentation gets less useful over time (unless you're very forgetful, or don't use the language much I guess), the language design feels ever more contraining and silly, and the community ever more aligned to either n00bs or people trying to turn the language into Java Lite.

      Ruby fits my mindset better, just like FreeBSD, Opera, vim, irssi and tcsh do. PHP, Linux, iBrowse, pico, AmIRC, and zsh used to, but people change. Maybe I'll love PHP again in a year or two when PHP5's a little more pervasive... either way, embrace diversity! :)

    37. Re:Using the right tool for the job by TheRaven64 · · Score: 2, Funny

      When the only tool you have is a chainsaw, every problem looks like fun.

      --
      I am TheRaven on Soylent News
    38. Re:Using the right tool for the job by 1110110001 · · Score: 2, Informative

      Set error_reporting to E_ALL and you see when PHP has to decide something you haven't defined. When you set your stderr to /dev/null you won't see errors in most unix tools and they do "something else". PHP has a recommended configuration. Use it!

      b4n

    39. Re:Using the right tool for the job by ignavus · · Score: 1

      When you are a nail, everything looks like a hammer.

      (i.e. if you are vulnerable, everything looks like a threat).

      --
      I am anarch of all I survey.
    40. Re:Using the right tool for the job by Photon+Ghoul · · Score: 1

      First of all, your post is as inflammatory as the one you're calling a troll.

      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.

      Yeah, it's kind of like going in and having to maintain a "Perl Guru"'s messy overly-terse Perl code. What a nightmare, all right!!

      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.

      Haha. I love the Perl zealots :). Your emphasis that Perl is good *if* "basic structured programming/OO principles" are applied. Well, really? When comparing the merits of two languages, you should assume that "basic structured programming/OO principles" are equivalent when using either language. Pointing to these "principles" and claiming that Perl scripters have some sort of patent on them is absurd. It applies to any language. Don't compare the script writer's methodologies when you're comparing language. It just makes you sound elitist.

      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.

      When did someone "suggest that PHP is a better language because it doesn't make you learn anything about software design principles"? Where did you read that?

      As far as being used in a business environment ... most businesses I have dealt with avoid Perl like the plague. It leaves too much up to the "principles" of the Perl scripter. Sorry, businesses don't need that.

    41. Re:Using the right tool for the job by ForemastJack · · Score: 1

      I know this isn't a direct response to your comment -- and I'm not really taking issue with anything you say -- but please don't leave out "documentation" in your list of things that make "all that is necessary to create fast, reusable, and reliable Perl code."

      That's really my problem with Perl (and PHP, too, sort of). A skilled developer can write all manner of amazing things with Perl. For themselves. The saying goes, "Write once, read never." That's why I hate Perl, as a guy who is forced to support others' applications.

      As a culture, Perl developers glory in obfusication. Wonderful, clever, hooray: until you get the shitty job of finding a bug Perl-er's three year old exercise in l33tness. I'd rather take out my eyeballs with a mellon-baller than deal with uncommented Perl code.

      Of course, I'm sure there are a million Perl coders out there who plan for maintainabilty -- and comment their code extensively. But when they don't, it's so much worse for everyone else who's left holding the sack.

    42. Re:Using the right tool for the job by ViolentGreen · · Score: 1

      Smalltalk is fast has a superb set of built in functionality and very flexible, and great OO support.
      Common Lisp is fast has a superb set of built in functionality and very flexible, and great OO support.


      I am going to have to take issue with this. Neither smalltalk or Lisp are fast. Smalltalk has issues with it's implimentation and lisp suffers from the fact that it requires recursion to do almost anything. I also wouldn't say that either has "superb set of built in functionality," especially when compared to PHP. On top of that, lisp has no OO support whatsoever. Lisp is a purely functional language.

      I don't know enough about python or ruby to comment on those but it seems to me that you just took common scripted languages and cut and pasted the arguemnt about php without even thinking about it. This is by no means "insightful."

      --
      Not everything is analogous to cars. Car analogies rarely work.
    43. Re:Using the right tool for the job by TimoT · · Score: 1

      You, sir, clearly do not know lisp. Take a look at the ALU site and the Common Lisp wiki for starters and please do not perpetuate these urban myths any further. About OO: the Common Lisp Object System (CLOS) was the first standardized OO language. Common Lisp is also far from purely functional. It's a multiparadigm language, just like C++, though in my opinion, much more elegant. It's also fast enough for most purposes, e.g. CMUCL, which compiles to native code, gets close to GCC in execution speed. Sometimes the generated code is even faster than code produced by GCC.

      Best regards,

      TimoT

    44. Re:Using the right tool for the job by killjoe · · Score: 1

      Shut up you ignorant bastard.

      1) phpxpath
      2) the DOM functions work just fine. They are marked experimental because the PHP folks are rightly conservative.
      3) The Sax stuff is baked.

      Just because you can't google or figure it out doesn't mean nobody else can.

      --
      evil is as evil does
    45. Re:Using the right tool for the job by killjoe · · Score: 1

      There is nothing wrong with ruby except the severe lack of documentation, automatic database pooling, tight integration with apache, lack of unicode functions and a small community.

      --
      evil is as evil does
    46. Re:Using the right tool for the job by Luguber123 · · Score: 1

      I've seen pretty screwed up perl code as well, code without any object orientation, code that is run from crontabs while it should be triggered from an event. PHP have some capacity OO wise as well.
      I like all gpl language implementations anyways, they don't have tons of lousy forks :)

    47. Re:Using the right tool for the job by Anonymous Coward · · Score: 0

      He clearly can google. He stated that much. Let's make it bit more clear for you, maybe this time you actually understand:

      One should not be forced to scour the 'net, google superguru or no, for documentation of basic libraries. That documentation should be included and good enough to prevent need for any outside information.

    48. Re:Using the right tool for the job by Anonymous Coward · · Score: 0

      lisp suffers from the fact that it requires recursion to do almost anything.

      Why is that a problem?

      I program largely in ML, which also relies heavily on recursion, and I completely fail to see why this would ever be a problem.

      (Hint 1: tail-call optimisation means that anything you might have been about to say about stack overflows is wrong.)

      (Hint 2: imperative loops can be defined very simply in terms of recursive functions. The converse is not true.)

    49. Re:Using the right tool for the job by nosferatu-man · · Score: 1

      No offense, but you don't know shit from fat meat. Lisp has no OO support? Lisp is slow? Lisp requires recursion? Recursion is slow? Lisp is a purely functional language? All wrong: completely, unequivocally, nine-seconds-of-googling-would-show-different wrong.

      And that's not even to get into the PHP discussion. Suffice to say that your opinions in that area are likely informed by a level of technical merit equal to that displayed above, and thus of no consequence whatsoever.

      'jfb

      --
      To spur "enterprise Linux," Big Bang, the distributed two-phase commit.
    50. Re:Using the right tool for the job by juhaz · · Score: 1

      And one more time. Explain to me how the object orientation of PHP is that much different then python.

      You're talking about PHP5, right? Everyone agress that PHP4's OO is piece of crap and nothing more than bit of syntactic sugar. PHP5 that hasn't even been released yet...

      OO implementation in PHP5 may well be quite nice and full-featured, but, just like Perls, it's still add-on in a late stage of language and the combination is whole lot different from something like Python that's build from ground up to be OO and only OO.

      Most obvious example would be the libraries. Are you willing to write everything from scratch instead of using whatever comes with PHP or can be found as 3rd party code. No? Oops, no OO here, your code will be a hodgepodge of OO and non-OO. Python's standard library is obviously OO since Python has been OO from the beginning.

      Why am I even explaining this, it should be obvious to anyone...

    51. Re:Using the right tool for the job by drew · · Score: 1

      well, first of all the global scope isn't really global. while i understand the reason behind why they made the 'global' scope way they did, it hurts the brain of any programmer who has used any other language, and takes forever for anyone new to php who has learned how to program in a different language to get used to. the bigger problem though, is that, other than a function, there is no way to restrict the scope of a variable to a block level entity. for example, suppose i do this in the beginning of my script:

      foreach ($global_arr as $foo) {

      $tmp = some_func($foo);

      some_other_func($tmp, $foo);

      }

      i have now just declared two variables, $foo and $tmp, that are global throughout the entire program, whether i like it or not. in any other language, the scope of those variables would be restricted to the for loop. (i realize that in some languages they would be be global variables by default, but you can at least force them to be local) so in a nutshell, you just stated exactly the problem with php's scoping: there is only a global space, a function space, and a class space.

      as for the object orientation, i cant compare to python because i've never really used it, but compared to my experience with other languages.... while the OO features of php5 look pretty nice so far, php5 is not even released yet, and it will be years before it is in widespread use. OO in php4 is really nothing more than the ability to put functions in data structs. none of the language functions are object oriented, there is no form of data protection for objects, and it's just kind of a pain all around.

      none of this is to say that i dislike php. (actually i do dislike it, but i dislike it less than most of the alternatives.) the language drives me crazy sometimes, but i still have been using it for over 3 years. the php language is certainly a pain, but i prefer php as a platform over anything else when it comes to working on the web...

      --
      If I don't put anything here, will anyone recognize me anymore?
    52. Re:Using the right tool for the job by Fweeky · · Score: 1

      There's at least one free book you can read online which covers most of the standard library, and a few other more general ones. Extensions tend to be at least sufficiently documented, especially if you use rdoc or can read comments from source. Aside from the less centralized documentation, I'd put it about on par with PHP's.

      Lack of database pooling? I've seen such things written in about 20 lines of Ruby, and the language makes it extremely easy to integrate it into existing software without breaking anything. It is bit of an odd criticism from a PHP user.. maybe you're thinking in terms of Ruby lacking an equivilent of mysql_pconnect? Ruby gets this in a more generalized form as part of object persistance in a daemonised interpreter.

      mod_ruby is at least as integrated with Apache as PHP, if not more so. Maybe too much; that's why I prefer to use FastCGI, since it's API gives me a simple to develop webserver neutral Ruby daemon in which I can keep objects cached in memory and thread and fork to my heart's content. FastCGI's great with PHP too; you can even put the FastCGI'd PHP's in a FreeBSD jail, or on to another machine entirely. Did I mention PHP's FastCGI support seems buggier than Ruby's? :/

      As to Unicode.. I'm English -- I don't bother learning other languages, why should I want to display them*? ;)

      The community isn't that small; it is however, quite active and full of experienced users. Quality over quantity.

    53. Re:Using the right tool for the job by runderwo · · Score: 1
      error_reporting would be more useful if it would actually throw an exception when the program fails (similar to how 'use strict' causes a Perl program to invoke the 'die' method when the programmer does something stupid). Having program structure problems hidden away in a web server log instead of smacking the programmer in the face during testing doesn't seem to contribute much towards code quality.

    54. Re:Using the right tool for the job by runderwo · · Score: 1
      A cut & paste troll? Yeah; cut & pasted straight from my own experiences with both languages. Rebut, or shut up. Don't mod down opinions you disagree with.

    55. Re:Using the right tool for the job by runderwo · · Score: 1
      Does PHP enforce declaration of variables? No. Does PHP enforce scope? No. Does PHP .. oh never mind. The point is that the parent made a snide comment insinuating that the only reason anyone prefers Perl and dog on PHP is because it makes them feel 'leeter'. There are probably a vocal minority that feel that way, but on the whole, there are numerous and important practical reasons to prefer Perl (or any other language for that matter) over PHP.

      Whether those reasons matter to any particular developer/project or not is not the issue. The fact is that they exist, and that means that people like the parent can stuff their snide digs that Perl users are nothing more than elitists.

      Your final comment about businesses avoiding Perl 'scripters' like the plague is telling that your experiences have most likely been limited to the script kiddie types. Perl code written by professionals is developed with, at a minimum, strict, taint checking, and warnings, has the components split up into packages with only public interfaces exported, has POD documentation for all public methods in packages, uses eval blocks to catch exceptions, has global variables confined to a single package with all other variables lexically scoped, uses references extensively, and uses as verbose of a syntax as necessary to make clear the intent of a particular section of code, including but not limited to regular expression patterns. Anything less makes an unmaintainable mess, and I wouldn't want to touch it any more than I want to touch your PHP code.

      But the point is, Perl gives you all the tools to not only develop quality code, but also to prevent yourself from making mistakes; it is only a matter of learning how to use them. I'd really like to see someone make a list of PHP features that contribute towards code quality, because obviously I'm missing something somewhere if it really has such features.

    56. Re:Using the right tool for the job by runderwo · · Score: 1
      Documentation is built in -- man perlpod. As I mentioned in another reply, you can write unreadable or unmaintainable code in any language. Developers who do so should not be holding down jobs. The problem with PHP is that it encourages unmaintainable code by purposefully omitting certain features that would go a long way towards improving code quality. They aren't omitted because they are unnecessary; rather they are omitted because they get in the way. That's a poor approach to language design in my book.

    57. Re:Using the right tool for the job by killjoe · · Score: 1

      Go read the documentation. It's perfectly clear. The guy is an idiot.

      --
      evil is as evil does
    58. Re:Using the right tool for the job by killjoe · · Score: 1

      Once again. The OO aspects of php4 support polymorphism and inheritance. Show me how it's lacking or that much different then python.

      The PEAR library is fully object based. It covers pretty much everything you need. If you need something not in PEAR then you can shop around to find some code that suits your style.

      --
      evil is as evil does
    59. Re:Using the right tool for the job by killjoe · · Score: 1

      Your example would work the same way in python, ruby, perl and php. The idea of declaring variables block scope only exists in a few languages, most languages are like php.

      "there is no form of data protection for objects, and it's just kind of a pain all around."

      Again no different then python.

      --
      evil is as evil does
    60. Re:Using the right tool for the job by killjoe · · Score: 1

      "Ruby gets this in a more generalized form as part of object persistance in a daemonised interpreter."

      Ick. I much prefer that php handle these things for me transparently.

      "Did I mention PHP's FastCGI support seems buggier than Ruby's? :"

      Don't know, I have never felt the need to use fastcgi with php. PHP has lots of neat features to make sure your code can't escape it's hierarchy, you can also selectively not allow certain functions to run.

      As for the community I have no complaints about the PHP community.

      --
      evil is as evil does
    61. Re:Using the right tool for the job by drew · · Score: 1

      in perl, that code written as nearly the same as possible in perl:

      foreach $foo (@global_arr) {
      $tmp = some_func($foo);
      some_other_func($tmp, $foo);
      }

      would indeed produce global variables, as all perl variables are global by default. however, as i mentioned in my post, most languages i have used that behave this way give you the option to make them local:

      foreach my $foo (@global_arr) {
      my $tmp = some_func($foo);
      some_other_func($tmp, $foo);
      }

      in this case $foo and $tmp are now local to the foreach loop. i can't speak for all languages (in particular i know very little about python and almost nothing about ruby), but the languages i that do know and use regularly fall into three categories with regards to scope:

      - languages that enforce block level scoping (e.g. c, c++, java)
      - languages that default to global scope but allow block level scoping by explicit declaration (e.g. perl, javascript)
      - php

      --
      If I don't put anything here, will anyone recognize me anymore?
    62. Re:Using the right tool for the job by killjoe · · Score: 1

      I will have to test your perl example. As fas I know there is no block level scoping in perl. I can assure that there is not one in python. In python you only have global, module and function level scopes.

      But we are veering off course. The original topic was about why php is unsuitable for opengl programming and nobody has put forth a sound argument as to why it's that way. It behaves very similar to perl, python, and ruby. I am not saying that all the languages are alike just that they can all do the same kind of things.

      As for C, C++ or Java I think those languages are overkill for most applications. I don't program in assembly anymore and I don't program in c/c++ anymore for the same reason. I dislike java with a passion. Python, perl, ruby and php are all OK in my book.

      --
      evil is as evil does
    63. Re:Using the right tool for the job by Photon+Ghoul · · Score: 1

      Great post, I agree with it overall.

      However:
      Your final comment about businesses avoiding Perl 'scripters' like the plague is telling that your experiences have most likely been limited to the script kiddie types.... [snip for space's sake]....touch your PHP code.

      Actually my experience is with businesses large and small and the scripters being professionals. I speak as a professional myself, with experience in both Perl and PHP. My "avoiding like the plague" statement comes from said businesses own dealings with Perl scripters, not my own. You know the PHBs? They see Perl as too chaotic, difficult to plan for, maybe even too esoteric (yes, this will be true as long as there are hordes of unemployed .NET and Java programmers out there) etc. Note that I am *not* saying that PHP is viewed in a more favorable light, except in the time needed to complete a project or prototype.

      I understand the technical merits and downfalls of both Perl and PHP (I have used both extensively in multiple professional settings) and I agree that in many ways Perl is superior from a technology standpoint.... but the poster I was replying to was falling back to the standard argument of using the typical (in his mind) scripter of X language being inferior to a scripter of Y language. He uses that to show that X language is inferior technology when his arguments have nothing to do with technology but methodology. He was the one bringing up the "leeter" argument and that's one of those idiotic attitudes that just needs to die.

    64. Re:Using the right tool for the job by 1110110001 · · Score: 1

      Use an other ini in your testing and development systems. Prepend the error string with alert(' and append with ') (which can be defined with php.ini). Or use your own error-handler which sends a Jabber message or whatever.

      Exception haven't been avaiable in PHP4 and it would only be usefull for warning or notice. I want them too, thus I agree with this point.

      b4n

    65. Re:Using the right tool for the job by Doctor+O · · Score: 1

      Nice try of changing the subject. Just to remind you, we were talking about PHP documentation and how some of it sucks ass. DOMXML is such an example.

      Just for the record, of course it works fine and of course I googled for it. The point was that with a good documentation I wouldn't have *needed* Google.

      I'm interested - why are you assuming I couldn't find out? The project is finished, but I'll check out phpxpath anyway, I find DOMXML a bit cumbersome to deal with.

      --
      Who is General Failure and why is he reading my hard disk?
    66. Re:Using the right tool for the job by Fweeky · · Score: 1
      "'Ruby gets this in a more generalized form as part of object persistance in a daemonised interpreter.'

      Ick. I much prefer that php handle these things for me transparently."

      I prefer the more general alternative; it's one of my desired features for PHP; even just with a (get/set)_persistant_variable() function or so (maybe this is doable with a newer SHM module?)

      Basically, with PHP you do:
      $db = mysql_pconnect(); // the only persistant object
      $app = new SomeWebApplication($db);
      $app->processRequest( );
      But with Ruby you can do:
      # naturally persistant across requests
      db = DBI.connect()
      app = SomeWebApplication.new(db)
      FCGI.each_cgi do |cgi|
      app.process_request(cgi)
      end
      The second one's faster, and means you can make SomeWebApplication.new fairly expensive; loading caches, compiling templates, executing longish db queries and such. mod_ruby I believe has similar features, only you need to check for the existance of the object, and make it global; that's similar to mod_perl behavior iirc and should be doable in PHP.

      It's all a matter of taste; how worried you are about performance/flexibility, and how much control you have over your servers I guess.
      "Don't know, I have never felt the need to use fastcgi with php."

      It's worth trying; it means if PHP crashes it doesn't take out your httpd (potential for a nice error page even if you blow up the FastCGI daemon), it makes your httpd processes smaller (our PHP's are hitting 80MB each atm), and it lets you have fewer PHP processes reflecting that most servers tend to split workload between dynamic and static. It also reduces dependence on the httpd; very fast servers like thttpd and friends become useful with PHP because it's all nonblocking socket IO.
      PHP has lots of neat features to make sure your code can't escape it's hierarchy, you can also selectively not allow certain functions to run.

      Ruby has a generalized $SAFE level, with increments from 0 to 4; similar to FreeBSD's securelevel sysctl. With FastCGI you can have daemons running as other users ala suexec. These two should cover a lot of needs security wise; both developers and admins.
    67. Re:Using the right tool for the job by killjoe · · Score: 1

      I have a 10 line (roughly) function that can can serialize and cache the output of any other function or an object. It was trivial to write and I use it often. Since I use ADODB for my database access I also have access to it's recordset caching abilities. It's quite nice and I urge you to use it if you any php work at all.

      I run apache 1.X so if my php crashes (very, very rare) it simply respawns another child process. I have never had the parent process lock up or crash. Apache is one hell of a web server.

      --
      evil is as evil does
    68. Re:Using the right tool for the job by Fweeky · · Score: 1

      Yes, serializing and caching to filesystem are easy (you can even use PHP serialization format with Ruby, although the built in Marshal does just as well), but it's still not as fast as simply keeping an object alive across requests, especially if they grow quite large. It's similar to the reason you don't want to recompile a script each request; loading a serialized cache involves IO, parsing and (simple) interpretation too.

      Actually, turok-mmcache provides a way to do this using shared memory; it just says "$value", so presumably that means it'll work with arbitary PHP values.

      We use Apache 2, btw; mod_fastcgi is stable there, and I believe thread-safe, so you can use a threaded Apache with forked PHP daemons safely. Even if not, it's nice to have the better designed Apache 2 without worries about mod_php's stability on it :)

    69. Re:Using the right tool for the job by Anonymous Coward · · Score: 0

      Java [...] is [...] better than nothing.

      I concur.

    70. Re:Using the right tool for the job by fishbot · · Score: 1

      Um, one or two corrections then.

      1) Show me the exception 'thowing', never mind the exception 'handling'. Unless you mean PEAR::isError() which is actually a conditional check. Which leads me on to...

      2) PHP is about as object oriented as a brick. As in, a brick is an object and lots of bricks is a house. That's about it. It does NOT support multiple inheritence. Hell, it doesn't even support proper pass by reference without explicitly telling it to! OO in PHP is like procedural in assembler - possible, you just don't wanna go there.

      Believe me I'm in a position to know. I had the misfortune of inheriting a complete finance system written in web facing PHP. Obviously nobody ever heard of separating you mission critical, government audited systems from crap that web monkeys churn out. Suffice to say I recommended to the business that it get binned and we either buy something off the shelf or rebuild in Java or something. They agreed.

    71. Re:Using the right tool for the job by fishbot · · Score: 1

      Sorry, just to clarify - all my comments refer to PHP 4.x. I realise that PHP 5 is supposed to be exactly the same as Java is every possible way (don't try to tell me it isn't - it's a blatant rip off to fix a fundamental broken technology) but very few people are using it in production servers. No hosting companies I know of are using better than current stable 4.x, and most large companies with PHP systems use PHP 4.0.x or 4.1.x.

  5. 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.

    2. Re:Practical uses for this technology by Anonymous Coward · · Score: 0

      a PHB who doesn't know any better...

      OMG!!!111!!

      We can build a whole new way of doing business around this!
      This is going to build the STICKIEST web-sites!
      We'll profit from all those eyeballs!
      This is so good we don't even need a business plan!

    3. Re:Practical uses for this technology by Fryboy · · Score: 2, Insightful

      When's your next Slashdot Meetup??

  6. 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
    1. Re:vsync by goatpunch · · Score: 1
      59 fps? Sounds like vertical sync at 60 hz. Anybody have any real performance figures?

      Err, slightly worse than 60fps...

    2. Re:vsync by atrus · · Score: 2, Interesting

      Many video cards, when operating in OpenGL, VSync by default, so I agree with you here.

    3. Re:vsync by Anonymous Coward · · Score: 0

      On WinXP AthlonXP 2600+ with ATI Radeon 9700pro i get 170fps.

    4. Re:vsync by DeltaSigma · · Score: 1

      No, that looks like a good 60 FPS to me. It drops if you increase the size of the window, and speeds up if you decrease the size of the window.

      I'm looking at it right now. A very respectable demonstration of technical prowess, I'll tell you that.

    5. Re:vsync by volvoguy · · Score: 2, Informative

      If the FPS given in the titlebar of the demo app are accurate, it's doing 160FPS on my modest machine (P4 2.8Ghz, 1Gb RAM, ATI Radeon 7500).

    6. Re:vsync by TheUnFounded · · Score: 1

      It hit 200+ FPS on my computer...

      P4 2.56, ATI Radeon 9700 Pro, 768 MB ram.

      *shrug* Kinda cool.

    7. Re:vsync by kription · · Score: 1

      196+ fps - p4HT 2.98g / 1gig RAM / GeForce 2MX (32M) @ default 500x500 box (read the php source)

    8. Re:vsync by Anonymous Coward · · Score: 0

      Actually there is a sleep value in the script and if you change it to 0 I have seen it reach 200+

  7. 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.

    1. Re:Correct me if I'm wrong, but... by Anonymous Coward · · Score: 0


      [lib='opengl32.dll']
      void glEnable( int cap ); void glDisable( int cap );
      int wglCreateContext( int hdc ); int wglDeleteContext( int hglrc ); int wglMakeCurrent( int hdc, int hglrc );
      void glLineWidth( float width ); void glPointSize( float size ); void glBegin( int mode ); void glEnd();

      void glClear( int mask ); void glClearColor( float r, float g, float b, float alpha ); void glClearDepth( float amount );

      void glColor3f( float r, float g, float b );
      void glVertex3f( float x, float y, float z ); void glVertex2f( float x, float y );

      void glShadeModel( int flags ); void glDepthFunc( int flags ); void glHint( int flags1, int flags2 );
      void glViewport( int x, int y, int w, int h );
      void glLoadIdentity(); void glMatrixMode( int mode ); void glPopMatrix(); void glPushMatrix();
      void glRotatef( float angle, float x, float y, float z ); void glTranslatef( float x, float y, float z );

      [lib='gdi32.dll']
      int SwapBuffers( int hdc );

      [lib='glu32.dll']
      void gluPerspective( double fovy, double aspect, double zNear, double zFar );

      No, you're just an idiot.

    2. Re:Correct me if I'm wrong, but... by DeltaSigma · · Score: 2, Insightful

      At least it let me know about the useful ffi extension. If it wasn't for this cute demo, I'd have never come across this.

    3. Re:Correct me if I'm wrong, but... by hey · · Score: 2, Informative

      Yeah, for example it uses glEnable() from Windows.

  8. 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.

    1. Re:Do not be fooled by this by Anonymous Coward · · Score: 3, Funny
  9. Hrm.. by Anonymous Coward · · Score: 5, Funny

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

    1. Re:Hrm.. by Anonymous Coward · · Score: 0

      You fit inside your kitchen sink?

    2. Re:Hrm.. by shfted! · · Score: 1

      The Washing Machine is more fun! Shhhh... don't tell anyone.

      --
      He who laughs last is stuck in a time dilation bubble.
    3. Re:Hrm.. by prockcore · · Score: 1

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

      Wait till you have kids.

    4. Re:Hrm.. by mrjb · · Score: 2, Funny

      Actually my dad tried this once [using the sink as bathtub] before I was born, according to legend, because the tiny house they bought had no shower-- used the sink as tub and got stuck. If he moved one way he'd turn up the burning hot peel-your-skin-off temperature water, moving the other way he'd turn up the so-cold-it-would-freeze-his-you-know-what-off water. My mom, instead of helping out, ran off to get the photo camera. None of the pictures she took got any good, they were all shaken cause of her laughing....

      --
      Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
  10. Actually faster FPS by Wallslide · · Score: 3, Interesting

    I have a 3ghz P4, Radeon 9700 Pro, and 1gb of RAM, and I get about 180FPS constant

    1. Re:Actually faster FPS by Anonymous Coward · · Score: 0

      Well aren't you special!!! For the record, this story isn't about a contest to see who can get the fastest FPS scores, it's about how someone actually used PHP to implement an OpenGL demo. The FPS was just quoted to allay doubts that it would be slow because it's PHP (a scripted language). Now go back to your benchmarking websites.

    2. Re:Actually faster FPS by Anonymous Coward · · Score: 0

      you sad bastard.
      I had to redo this because i apparently have to wait 20 secs before i can submit a comment after hitting reply. So, not only are you a sad bastard, but you're also a twat because she's gotten fed up with waiting and has now gone to sleep. so, i'm going to sit here and wait for you, wallslide. it's now personal.
      i kid about the personal thing. Unfortunately, I'm not kdding about getting laid tonight.

  11. 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
    1. Re:Rendering 3D graphs of a slashdotting by Anonymous Coward · · Score: 0

      You realize, of course, that this usage (running traffic graph from a script) has been available in Perl for something like 5 years, right?

    2. Re:Rendering 3D graphs of a slashdotting by ElForesto · · Score: 1

      I think that's probably the most appropriate application. I hate having to download different graphing libraries for apps written in PHP, and standardizing on OpenGL seems like a good idea to me.

      --
      There is a difference between "insightful" and "inciteful" other than spelling.
    3. Re:Rendering 3D graphs of a slashdotting by Anonymous Coward · · Score: 0

      Yeah, but not in 3D AND real-time at the same time!!

    4. Re:Rendering 3D graphs of a slashdotting by Ninwa · · Score: 0

      Or 3d site navigation, or 3d directory traversing... wait they already have that in the movie hackers...

  12. Re:Practical use by Mr.+Sketch · · Score: 1

    Unfortunately, it's not a port, it's windows only using the Win32 API. I can see someone didn't RTFA.

  13. 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
  14. your mileage WILL vary by haute_sauce · · Score: 1, Interesting

    When I ran it on my laptop, I was getting an average of 120 FPS. And while I respect the effort and appreciate the use of OpenGL, I cant see this killing Flash in the near future (or in any other parallel reality). Server-side scripts should stay just that, IMHO.

    1. Re:your mileage WILL vary by Anonymous Coward · · Score: 0

      i have been using php to do everything from creating
      server apps (yes multi threaded server applications) to full apps for windows and linux wht php brings is the east of vb the cross portability of java. It's great and you dont need all these extra modules like you do in perl. plus this wouldnt be used to replace flash this is ment to replace vb :) or some other silly windows language. IMHO this kix the whole .net thing in the ass.

    2. Re:your mileage WILL vary by Anonymous Coward · · Score: 0

      Sorry, but flash will still be killing it.
      How long does it take to design an animation with objects moving text effects in flash vs coding in opengl, not working anywhere except winshit.

      sorry but flash still beats it.

  15. 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?
    1. Re:Perfect application by timothyf · · Score: 2, Informative

      You'll probably want to keep looking. As others have mentioned, this only calls Win32 OpenGL API (using some bundled DLLs?), and requires that PHP be run from the command line. While the code may be more portable for being written in PHP (although, as I said, it relies on external libraries written for Win32), it won't run in your browser.

      However, you might take a look at Shockwave Flash Remoting with PHP. That will run in your browser.

    2. Re:Perfect application by Anonymous Coward · · Score: 0

      WTF are you talking about?

      This doesn't run in a client's web page. PHP runs on the server.

      This is no different than using OpenGL in Perl or Python.

    3. Re:Perfect application by psocccer · · Score: 1

      That's not how it works, you don't run a remote 3d interface, you write opengl apps using the php language. It appears to be just a language binding, it has nothing to do with servers or websites. All you get here is the the constructs the php language give you (dynamic typing, etc) with a way to create a local opengl app. Don't think flash, think more like XUL or Visual Basic (both of which require a runtime), it could be delivered and run over the web but not without a lot of work and already having the runtime locally on your machine.

    4. Re:Perfect application by damiam · · Score: 1
      RTFA. This has nothing to do with the web. This is just a wrapper around a .dll that allows PHP programs to access the video card and use OpenGL on the local machine. It's Windows-only and the API probably sucks.

      Python and Perl also have (much more mature) OpenGL support. I doubt they would fit your needs either (OpenGL is for real-time local graphics, not networked visualization), but they'd almost certainly be better than this hack.

      --
      It's hard to be religious when certain people are never incinerated by bolts of lightning.
    5. Re:Perfect application by Bronz · · Score: 1

      While this is cool, it isn't any more "web" than doing opengl in C++.

    6. Re:Perfect application by MagPulse · · Score: 3, Informative

      You probably want a Java3D applet, which can use OpenGL or Direct3D. You can access your database from it using JDBC or just grab a flat file from a URL, and then visualize it however you want.

    7. Re:Perfect application by Turmio · · Score: 1

      Uh no. This is a client side application, OpenGL bindings for PHP. You can't use it with a web server so that it renders some polygons into client's browser window. Sheesh.

    8. Re:Perfect application by haluness · · Score: 1

      You could look at Jmol at http://jmol.sourceforge.net/. Its pretty handy for viewing molecules and can be used standalone or as an applet. People have even used it to view orbitals and surfaces.

    9. Re:Perfect application by unDiWahn · · Score: 1

      Many people seem to have replied something along the track of "RTFA -- this is server-side only, it won't render in your browser, blah blah blah".

      They are, of course, correct -- just not very creative. This would be perfect for a web interface to a server somewhere. I do very similar things in C CGI scripts now -- basically, I have a web-interface that allows a user to set parameters, and submit it to my server. This server needs to model a huge amount of data, using those parameters. It then renders the result to a file, converts it to a jpg or something similar, and sends that image down to the user's browser.

      Sure, it doesn't allow for much in the way of animations or quick real-time feedback, but its a great way to visualize complex models over the 'net -- and you don't need to worry about whether or not the client's CPU/GPU can handle it.

      I suppose you could create an animation in an animated GIF, or create an AVI and stream it down. Maybe there's a way to utilize the Quicktime VR plugin?

  16. No by autopr0n · · Score: 1

    Actually, being able to render a scene in open GL and send it to a client over the web would be very useful, not for real time animation, but it could certainly be cool for doing custom 3d graphics for a website. Imagine something like a web based Myst rendered in real time on the server. In this case, though, they are using PHP GTK for client side apps written in PHP.

    --
    autopr0n is like, down and stuff.
    1. Re:No by Billly+Gates · · Score: 1

      Dude your website is really fucked up with IE.

      I keep getting an error on line 71 whenever I hit the scrollbar up or down. It makes your site worthless.

    2. Re:No by dave420 · · Score: 1
      "web based myst"

      ew.

  17. PHP Simple DirectMedia Layer Extension by Anonymous Coward · · Score: 3, Interesting

    You'd be surpised what get's prototyped in PHP e.g. http://sourceforge.net/projects/phpsdl/ - "PHP SDL module is a wrapper/binding of Simple DirectMedia Layer for PHP. The goal of this project is to allow rapid prototyping of multimedia applications using PHP."

    Usually doesn't get beyond the prototype though.

  18. Mod parent down. by biendamon · · Score: 0, Offtopic

    Darn trolls...

    Why is it that every Slashdot discussion has to start off with some idiot trying to ruin the fun for everyone else?

    There aren't any viruses in these scripts, 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. They work quite nicely (I like the changing spirograph).

    1. Re:Mod parent down. by Anonymous Coward · · Score: 0
      There aren't any viruses in these scripts, 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.
      welcome to /., i hope you have fun
    2. 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
  19. Re:Practical use by kunudo · · Score: 1

    My other thought is that this is a convenient port of opengl to any platforms that currently do not support it.

    It's not a port, it's just calling opengl functions in php. You'd have to vnc to a windows box or something to view this on a platform that doesn't support openGL. What platform doesn't support opngl and supports php though? Maybe there are some..?

  20. Two words... by tickticker · · Score: 4, Funny

    ...better pr0n

    --
    This sig doesn't do windows

  21. 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.
    1. Re:This is NOT Server-side by phreakv6 · · Score: 1

      "This is all client-side"
      Its not even client-side.It runs on a standalone mode.There is no server or client here.

      --
      fifteen jugglers, five believers
  22. Neat, Yet Misused by mfh · · Score: 0, Redundant

    I'm sorry but I have to reject the idea of running openGL with PHP. The concept makes about as much sense as using Flash intros.

    However I will add that there is a neato factor to all this, but it only goes so far. It's just silly to allow the unwashed masses access to this kind of technology because it's going to end up like Flash anims, and further plague our internet with CRAP.

    --
    The dangers of knowledge trigger emotional distress in human beings.
    1. Re:Neat, Yet Misused by Anonymous Coward · · Score: 0

      This can't run on the client's machine.

      PHP runs on the server. Just like generated web pages. Mozilla/IE don't have a PHP interpreter built in. Duh.

      This isn't anything like Flash. This is like using OpenGL from Perl or Python.

    2. Re:Neat, Yet Misused by Saeed+al-Sahaf · · Score: 0, Flamebait
      It's just silly to allow the unwashed masses access to this kind of technology because...blaw, blaw, blaw...

      Typical elitist crap of the type spewed endlessly here at Slashdot. Unwashed masses? Who the fuck are YOU?

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    3. Re:Neat, Yet Misused by gregstumph · · Score: 1

      *sigh*

      Both this post and the one it comments on make the invalid assumption that PHP must run on a server, and only provides output via a browser. PHP can be run locally, using a PHP interpreter. That's how this OpenGL example works.

      Flash intros to web pages have nothing to do with this (silly, yet interesting) coding example.

    4. Re:Neat, Yet Misused by Anonymous Coward · · Score: 0

      I'm sorry but I have to reject the idea of running openGL with PHP. The concept makes about as much sense as using Flash intros.

      Only if you haven't got a clue what you are talking about. This has nothing to do with the web. PHP is a general purpose scripting language, like Perl or Python. It has nothing to do with websites.

    5. Re:Neat, Yet Misused by Anonymous Coward · · Score: 0

      duh... I was saying that PHP doesn't run in your client's browser like Flash or something does

  23. Re:Bah. As usual, Lisp did this years ago. by Jhawkeye83 · · Score: 1

    What does that have to do with anything?

    --
    Quality over Quantity.http://www.virusgaming.com/
  24. 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?
    1. Re:How about a new set off 'On Demand' products? by sampowers · · Score: 1

      I think the fine gentlemen at Jerkcity would take offense to that statement. ;)

  25. Re:Bah. As usual, Lisp did this years ago. by Anonymous Coward · · Score: 0

    What's worse than a smug lisp asshole?

    One that can't correctly spell 19 words in a row?

  26. Feedback by Anonymous Coward · · Score: 2, Funny

    The author welcomes feedback with practical uses for this technology.

    Because he couldn't think of any.

    *ducks*

  27. And I say, by consumer · · Score: 3, Funny

    welcome to the party, PHP.

    1. Re:And I say, by standsolid · · Score: 1
      There are more happening parties to be sure, but I'm glad we got another one going.
      #
      # Yes it uses Perl, you non-believer :-).
      #
      Just look at the source...
      --
      WTPOUAWYHTTOTWPA
      What's the point of using acronyms when you have to type out the whole phrase anyways?
  28. Purpose by Nicholas+Evans · · Score: 1

    As I read the discussion, I notice plenty of people missing the point of this. So, to remind you all, it's for a contest. And from the looks of it (His entry making /. and all...), he's about to win the contest too. Just a cheap party trick, but it gets you free stuff.

    1. Re:Purpose by OzRoy · · Score: 1

      Yes it's for a contest. But the very first criteria is "Your PHP 5 application should be something that is potentially useful to the PHP community."

      This is not useful in any way as far as I can tell.

      It's like trying to enter your volkswagon beetle in Formula 1 race. Totally pointless.

    2. Re:Purpose by OzRoy · · Score: 1
      Oops.

      My mistake. I got this competition mixed up with the official PHP5 competition

  29. Just a wrapper by Theatetus · · Score: 3, Insightful

    Well, it's not a port or an implementation; it's a wrapper to a DLL. That's the fun of dynamically loaded libraries: you can call opengl, gtk, qt, COM, CORBA, $WHATEVER_YOU_WANT from $WHATEVER_LANGUAGE_YOU_WANT as long as you take the time and effort to write a wrapper label, which this guy did, and he wasn't the first.

    --
    All's true that is mistrusted
  30. OpenGL demos-oh no... NO!!! This can only mean... by Richard_L_James · · Score: 1

    ....that damn 3D-studio duck will be returning to our screens within days.... Grrrrr! Please no.... it can't be allowed to happen my duck nightmares have been reoccuring ever since I first saw that duck a few times in the mid 90's.... quack quack.... Noooooooooooooo

  31. Very Cool by Agret · · Score: 0, Interesting

    I suppose if we did some code hacking we could get it to render the OpenGL scene and take a screenshot then save the screenshot as a file. From then on everyone could be sent that screenshot off the page. Sites with Half-Life and Quake2 maps wouldn't have to manually take the screenshots. PHP would be able to do it all for them (if they got a good camera location anyway :P)

    --
    Have you metaroderated recently?
    1. Re:Very Cool by Anonymous Coward · · Score: 0

      What?

    2. Re:Very Cool by Anonymous Coward · · Score: 0
      What?

      Only if the application was already in PHP, which it's not, so I don't know what you're talking about.

      This doesn't give you access to a framebuffer which you can grab - if that's what you think.

      Actually I can't even tell what you're talking about.

      My brain hurts after reading your post.

      Sites with maps still want to find a good location in the map, and that'll require people. Most games can record the movements of a player and when playing it back take screenshots too, which is how it could be done. But then you'd have to verify it anyway...

      Your post makes my brain hurt.

    3. Re:Very Cool by Anonymous Coward · · Score: 0

      it's not difficult to grasp what he's saying. Turn this into a server side thing that renders and then add a wrapper to retreive the framebuffer, and you could have a webpage that lets you walk around a quake map and would return screenshots in png format.

  32. The spirograph is definitely the coolest by caryw · · Score: 2, Insightful

    So why not have 5 of them?

    Here's the slightly altered code. (right click, save)

    - Cary

  33. What about by T-Kir · · Score: 3, Funny

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

    For a moment I thought of someone writing a PHP script to dynamically generate Perl scripts for web output... just for no real reason

    But then I thought.... Naaaaaa.

    ;)

    P.S. Anything on NeHe about this yet? I did a text search of the front page but nada (I haven't been to the site in months).

    --
    Are you local? There's nothing for you here!
    1. Re:What about by Anonymous Coward · · Score: 0

      how about php script that dynamically generates javascript which dynamically generates 6502 instructions for an embedded applet running a 6502 emulator.. you think I'm kidding? huh?

    2. Re:What about by reanjr · · Score: 1

      You know a while back I actually needed something like this. I don't recall why. It was using ASP, though and there was nothing I could do.

      I ended doing it in some other way that probably ran 5 times as fast but took 5 times as long to develop.

  34. Best use... by rffmna · · Score: 0

    porn in php. woot!

    --
    -------
    FM Clan
  35. You're much too easily impressed. by Anonymous Coward · · Score: 0

    "Technical prowess"??! It's just connecting the dots, not even coloring inside the lines with crayons. If they'd written their own OpenGL IMPLEMENTATION instead of just wrapping pre-existing OpenGL libraries somebody else wrote, or if they actually implemented an interesting and original OpenGL game or application in PHP, then there might be a reason to be impressed, but simply connecting the dots that somebody else created is not impressive, certainly not "technical prowess". Hardly impressive.

    1. Re:You're much too easily impressed. by DeltaSigma · · Score: 1

      Harsh, but deserved. The first thing I did was pull the php file onto the win-php executable as was suggested in a comment above. Once I looked at the source (or more specifically, looked at the names of the libraries) it became quite apparent what was going on here. Give a fledgling programmer a break though, m'kay? So I made a mistake, it's not like slashdot is the source for technical accuracy, or as this story demonstrates, journalistic accuracy.

  36. practical uses for this technology by Anonymous Coward · · Score: 0

    One word: p0rn

  37. 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
  38. Who's getting the most FPS? by asherman · · Score: 2, Informative

    On my 1.4ghz Pentium M/Radeon 9000 laptop i'm getting 230-240 fps on the fastest spirograph.

  39. Cant wait till ads rely on my processor even more! by Moonpie+Madness · · Score: 3, Funny

    think about it, im surfing the web, and some stupid ad comes up and demands my processor and video card take time away from whatever I purchased them to do... arrgh... unless I want to disable all the latest plugins or something, and that's a hassle to my lazy moonpie pudged ass

  40. 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).

  41. ill give you a practical use for it, by Anonymous Coward · · Score: 0

    Duke Nukem Forever online!

  42. Re:The animation can't be interactive. by gl4ss · · Score: 1

    huh, sorry but what the hell are you talking?

    it(the story) is a program you run locally, it's not a competition to anything web related.

    --
    world was created 5 seconds before this post as it is.
  43. Open squared? by erucsbo · · Score: 1

    If PHP is open source does this make it Open^2GL?

  44. This is no big deal by Anonymous Coward · · Score: 1, Informative
    OpenGL is just a library. You can link it in to anything which allows libraries to be linked in. That includes C programs, Java programs (JNI), C++ programs. But it doesn't stop there... PHP has a modules/extension mechanism; it can link in DSO files. But so can Apache and a host of other things. In fact, maybe I'll write an Apache/OpenGL module so that people can make stuff appear on my screen by doing web stuff... that would be really easy to do if you've written some Apache modules before, and I've done plenty of that, but I'm not really sure what I would do with this.

    ----------
    mobile porn

  45. Re:The animation can't be interactive. by Anonymous Coward · · Score: 0

    Dude, keep that smack quite... Last think we want is someone implementing PHPActiveX controls/applets... ugh...

  46. Not to 'bash' or anything, but... by soloport · · Score: 2, Interesting

    I confess: I've been migrating away from bash and Perl script development, toward using PHP CGI scripts, for a while. It's just too convenient to not use as a CLI scripting language.

  47. real time by KalvinB · · Score: 1

    When one thinks OpenGL they think real time graphics. 59fps sounds impressive until you look at what it's doing in 59fps. Unless he's got his vsync locked that demo should be going several hundred FPS even on a lowly GeForce 2 MX and a barely over 1Ghz processor.

    When cross platform is more important than "wow" factor and speed PHP might be appropriate. Otherwise you need to stick to compiled languages. If it can only push a few basic primitives with simple vertex based coloring at 59fps that doesn't leave much time for anything complex.

    Neat but very niche. I don't think it'll ever get into the "because it's a good idea" category. It seems to be suited best in the "because I can" category.

    Ben

  48. Language elitism by Anonymous Coward · · Score: 0

    Just so I can be sure not to be mocked in the future, could you - the dear readers of this post - please assign a tick beside which language on the scale it's acceptable for OpenGL to support.


    Assembly OpenGL
    Basic OpenGL
    XSLT OpenGL (heh)
    Ecmascript OpenGL
    Haskel OpenGL
    Scheme OpenG
    Python OpenGL
    C OpenGL
    Ruby OpenGL Java OpenGL
    .Net OpenGL/br />

  49. Didn't work? by Anonymous Coward · · Score: 0

    When I try to run it, I get the error message:

    PHP Startup: "I.: Unable to initialize module
    Modules compiled with module API 20020429, debug=0, thread-safety=1
    PHP compiled with module API=20040412, debug=0, thread-safety=1
    These options need to match

    Any ideas?

    1. Re:Didn't work? by javax · · Score: 1

      this will not work with WINE.
      Please buy that OS from Redmond.
      Thank you for your cooperation.

    2. Re:Didn't work? by Anonymous Coward · · Score: 0
      Any ideas?

      Those options need to match.

    3. Re:Didn't work? by Anonymous Coward · · Score: 0

      I'm using XP SP1, not WINE. Thanks anyway.

  50. Interesting... by cr0sh · · Score: 3, Interesting
    Let me first say I know this is client-side and not server-side.

    I have recently been playing around with Python, PyGame and OpenGL (I love the NeHe tutorial conversions done for PyGame) - I have been pretty pleased with the speed (OpenGL does all the heavy lifting - with a proper culling algorithm and scene graph implementation, speed could go up more with more complex scenes), especially on the machine I am using, which is low-end by many people's definition (P-3/450 w/GeForce 2 - definitely not a gaming machine, but works well enough for me).

    Now, I don't know much about OpenGL yet, but is it possible to render to a file instead of the graphics buffer? If it were, then this thing could (in theory) go server-side (provided the server has the proper APIs and DLL, of course) - then render to a file for display by a web server.

    Such a system could be useful for online data visualization services or other similar systems (mapping, network visualization, etc)...

    --
    Reason is the Path to God - Anon
    1. Re:Interesting... by Tokerat · · Score: 2, Interesting

      Now, I don't know much about OpenGL yet, but is it possible to render to a file instead of the graphics buffer? If it were, then this thing could (in theory) go server-side (provided the server has the proper APIs and DLL, of course) - then render to a file for display by a web server.

      Such a system could be useful for online data visualization services or other similar systems (mapping, network visualization, etc)...
      My thoughts exactly. PHP already does this with the imaging funcitons, only in 2D. I assume that to create images from scratch, PHP is already using a framebuffer to draw into before converting the image to the proper file format, so hopefully it could become as simple as making 2D images is.

      The really neat thing is that PHP can create SWF (Flash) files with the proper libraries installed, I wonder if one could generate server side Swift3D-style animations with this, although if you think about it, OpenGL wouldn't really be nessisary as the Flash Player would have to do all the rendering client-side anyways...

      Neat stuff.
      --
      CAn'T CompreHend SARcaSm?
  51. Re:Cant wait till ads rely on my processor even mo by chabotc · · Score: 1

    You sound a little confused there sonny..

    This is a _php extention_, so the only way you would see php generated 3d images in your browser would be if they were rendered on the website's server, then converted to gif/jpg, and send to your browser as image.. Thus taking no cpu power from your computer

  52. 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.

    1. Re:Not an implementation, but a binding by Anonymous Coward · · Score: 0

      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.

      This PHP binding seems to be a good way to implement 3D graphics through web pages in an open way. Anyone care to implemement this in Konqueror and Mozilla with some shortened tags - e.g. similar to the img tag with attributes like border, height, width and have say simple non executable filename as another parameter for the OpenGL data so that a clueless-vintage-techie like me can some day use it from a crib sheet. The data file I guess needs to be compiled by some application that makes the 3D program?

    2. Re:Not an implementation, but a binding by Xeger · · Score: 1

      Since PHP executes server side, you (the webmaster) wouldn't need to worry so much about your users' security, because no OpenGL or other executable code would be running on their systems. We're all familiar with PHP scripts that use ImageMagick or imlib to render 2d graphics at the user's request. I can easily see this OpenGL PHP binding being used for the same purpose, only with 3D graphics. With some slight modification, we could use a software driver in combination OpenGL's render-to-texture features to support realtime rendering into an image. Run the image through imlib to get a GIF file, and stream it to the user...voila, you have dynamically generated 3D graphics on your web page, without any work on the part of the user's browser!

  53. Re:Practical use by Anonymous Coward · · Score: 0

    Don't blame him for not RTFA, this is slashdot after all.

  54. How can I run this in a webpage? by Anonymous Coward · · Score: 0

    That would be badass, times two.

  55. I'm cool! by Anonymous Coward · · Score: 0

    I went from C, to PERL, to PHP! w00t! I love PHP!

  56. DirectX in PHP - Possible? by GameGod0 · · Score: 1

    A while back I was looking at PHP's COM support...
    Technically, shouldn't it be possible to use DirectX with PHP as well, using this COM functionality?

  57. wft? by mattyrobinson69 · · Score: 1

    i thought php was server side - shouldn't this be a javascript library or something?

    whats the point in openGL on the server side? it can animate the data as it parses it?

    1. Re:wft? by ReNeGaDe75 · · Score: 1

      PHP can be run locally from the command line to create applications. It's nowhere near as common as server side scripting (I've never used it locally myself), but it is possible.

      --
      Hypocrisy is the 8th deadly sin.
  58. Re:Me by iridiumz0r · · Score: 1

    uh o_O. http://developers.slashdot.org/comments.pl?sid=110 441&cid=9371773 http://randomphp.net/

  59. Avoiding DLL Hell by tji · · Score: 3, Interesting

    I love his method for avoiding DLL problems.. the dll file is incoded in the program's source code, and is written out at run time:

    ---
    if ( is_file( "SimpleWndProc.dll" ) ? filesize( "SimpleWndProc.dll" ) != 2560 : 1 )
    {
    $dll = "eNrtVU9IFGEUf7NpTbZue1hCYqlvQT3JslsG0clt/aho1XHND OnguDutY+uMzh80"
    . "KDrYQTPJS1TUoWMEdSpYrEOEsQl66yD9gT1ILCHhIcqDML35Z la3IgO7mQ9+733v"
    . "fe9733vffN+blu4p2AEAFQjLAsiBQ03wd3qD8B2c9sHT3fOhH JeYD53pk3UyqKkZ"
    . "TRwgKVFRVIP0SkQzFSIrpLmtgwyoaSlcXV1V68YYevv9/ZFnd 8fKcQwxe2tirBHl"
    . "80fXmUzKqT577k+5CBQgwWEluZm11AvgC+3hKr3gcQu0ye+Cu Jo99qxPlyQ7AFfx"
    [snip]
    . "kdWIJ8pHfdFAdH90uzf+D/QDFVAQCA==";

    $dllout = fopen( "SimpleWndProc.dll", "wb" );

    if ( !$dllout )
    die( "Unable to extract SimpleWndProc.dll" );

    fwrite( $dllout, gzuncompress( base64_decode( $dll ) ) );
    fclose( $dllout );
    ---

    ( He said in the comments that it required a DLL file to work for various reasons, and I guess he wanted to have everything contained in one file... But, it's still pretty funny. )

  60. Correction by Xeger · · Score: 2, Informative

    Oops! I meant to say: That would imply that all of the 3D math, texture mapping, shading, rasterization, etc was written in PHP. This is what happens when we post to Slashdot before having our afternoon triple espresso!

  61. some people use over 3 year old computers... by mrjb · · Score: 1

    ...insensitive clod!

    --
    Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
  62. Ha! by mfh · · Score: 1

    Nice troll, Troll. There is nothing elitist about what I have said in regards to PHP and openGL. I think the combination is an abomination! I know you may have a problem with my unwashed masses comment, but in regards to the misuse of Flash, anyone with half a clue would completely understand the comment and perhaps applaud it. You are obviously part of the unwashed masses who would disagree and I bet you have a Flash-driven Geocities page to prove it.

    --
    The dangers of knowledge trigger emotional distress in human beings.
    1. Re:Ha! by protohiro1 · · Score: 1

      The guy did it for the hell of it. No one is proposing that we start using php for graphics coding. Just proving that we could if we wanted to.

      --
      Sig removed because it was obnoxious
  63. Ha!!! by mfh · · Score: 1

    > Only if you haven't got a clue what you are talking about.

    Hahahahahahahah... hahahahaha!!! I've taught PHP & MySQL at college level, and I'm a programmer who uses PHP & MySQL on a regular basis. So I happen to have some grounding in this subject matter. So, it's you who don't know what you're talking about, actually.

    > This has nothing to do with the web.

    Oh give it time.

    > PHP is a general purpose scripting language, like Perl or Python. It has nothing to do with websites.

    Hahahahahahahahahahahahahahahahaha!!!!

    Of course it's a scripting language. I just have to laugh because you're pretending it was developed for 3d design. That's ridiculous. PHP was designed for the web, unlike Perl. It's a product of the Apache Software Foundation.

    From the php.net site: PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

    --
    The dangers of knowledge trigger emotional distress in human beings.
    1. Re:Ha!!! by Anonymous Coward · · Score: 0

      I call bullshit. If you've lectured this stuff, I pity your students. This is an extension to PHP that renders scenes on the machine it is running on. It accesses a Windows OpenGL driver through a DLL. There is simply no facility for transmitting the OpenGL calls over the Internet to where they will somehow be rendered by the client.

      Either you have no clue about PHP, or you didn't read the article and jumped to some stupid conclusions. Which is it?

      You can't wave away the fact that your whining is completely irrelevent by saying "give it time" as the fundamental mechanisms are all wrong to do what you are complaining about. You'd need to have PHP running under WSH on every client, which requires massive amounts of work to make it safe and doesn't address deplyment issues at all. This project doesn't attempt to do any of that.

      Please point out where I pretended it was developed for 3D design. I said nothing even close to what you claim.

      I fail to see why you are quoting the PHP homepage at me - I already stated PHP is a general purpose language, and I was referring to this OpenGL extension when I said that it had "nothing to do with the web". PHP didn't arise with the Apache Foundation at all, they adopted it not long ago.

      The laughing just makes you look childish and embarrassed btw.

    2. Re:Ha!!! by mfh · · Score: 1

      > I call bullshit. If you've lectured this stuff, I pity your students.

      Pity yourself.

      > This is an extension to PHP that renders scenes on the machine it is running on.

      And Flash differs how? And who controls how this is used over the net? You appear to place far too much trust in programmers today. This is going to be misused, imho.

      > There is simply no facility for transmitting the OpenGL calls over the Internet to where they will somehow be rendered by the client.

      Wherever they come from, be it the client or the server, they could still be malicious and misused. It would be ignorant to think otherwise.

      > Either you have no clue about PHP, or you didn't read the article and jumped to some stupid conclusions. Which is it?

      Why does it have to be one or the other? Couldn't I just have read the article and made informed conclusions about it, in that this appears to be innocent now, but could be misused by bad people / bad companies? Why are you defending it? Did you code it?

      This statement is meaningless: You can't wave away the fact that your whining is completely irrelevent by saying "give it time" as the fundamental mechanisms are all wrong to do what you are complaining about.

      > This project doesn't attempt to do any of that.

      That's the crux of my arguement: yes, this project appears harmless, but it could be manipulated maliciously. It's still to early to tell how far it could go, but it's bad practice to create systems for content delivery that impose intense graphical CPU/GPU usage, without any standards of conformity, or checks and balances.

      > The laughing just makes you look childish and embarrassed btw.

      Maybe, but laughter is hard to control when I read statements like yours.

      --
      The dangers of knowledge trigger emotional distress in human beings.
    3. Re:Ha!!! by Anonymous Coward · · Score: 0

      mfh:
      you are a fucking moron.

    4. Re:Ha!!! by groomed · · Score: 1

      And Flash differs how?

      In pretty much every way.

      And who controls how this is used over the net?

      It can't be used "over the net". Conceivably somebody could write a plug-in that allows people to run PHP in a webbrowser, as well as some bindings to the necessary OpenGL libraries, but that is possible for any language.

      That's the crux of my arguement: yes, this project appears harmless, but it could be manipulated maliciously.

      No, it could not.

      It's still to early to tell how far it could go

      Not at all. It won't go anywhere.

      but it's bad practice to create systems for content delivery that impose intense graphical CPU/GPU usage, without any standards of conformity, or checks and balances.

      He didn't create a "system for content delivery". He just wrote an app that uses OpenGL. That he used PHP to write the app is irrelevant apart from the novelty factor.

    5. Re:Ha!!! by mfh · · Score: 1

      > mfh:
      you are a fucking moron.


      Maybe, but I'm a happy one. Can you say the same?

      --
      The dangers of knowledge trigger emotional distress in human beings.
    6. Re:Ha!!! by mfh · · Score: 0

      > In pretty much every way.

      This process is still young, but the eventual direction this will take is 3d apps over PHP and the web. It's bound to go that way. How could you deny that? You sound like Bill Gates when he said that computers will never need that much memory.

      > It can't be used "over the net".

      Currently, no, but that is bound to change when Gamespy figures out how to exploit this into Flash-like popup ads that can't be disabled, at all. Development money only comes from greed or enlightenment, and there is plenty of greed to go around these days.

      > Conceivably somebody could write a plug-in that allows people to run PHP in a webbrowser, as well as some bindings to the necessary OpenGL libraries, but that is possible for any language.

      Not exactly what I was saying, but close enough I guess. I think it's extremely viable for a plugin to be designed that will use this, and many will adopt it for websites as a result. Why the hell wouldn't they? It's not a totally bad idea, just one that scares me somewhat, if it's used maliciously.

      > No, it could not.

      There are systemic misuses and outright exploits. I am sure that any new system has both. You would have to agree, no? Or have you been sleeping in class?

      > He didn't create a "system for content delivery". He just wrote an app that uses OpenGL.

      I'm saying he has triggered the inevitability.

      --
      The dangers of knowledge trigger emotional distress in human beings.
    7. Re:Ha!!! by groomed · · Score: 2, Insightful

      This process is still young, but the eventual direction this will take is 3d apps over PHP and the web.

      No, for the simple fact that this project is not headed in that direction. It does not provide for 3D apps over the web.

      It's bound to go that way.

      No, because in order for it to go that way, a terrible amount of work would need to be done, and the end result wouldn't provide anything that doesn't already exist.

      I think it's extremely viable for a plugin to be designed that will use this, and many will adopt it for websites as a result. Why the hell wouldn't they?

      Because PHP is not very well suited to the task, and better solutions exist. This hack is on the order of building a toilet out of LEGO's. Possible, but neither viable nor a harbringer of things to come.

      It's not a totally bad idea, just one that scares me somewhat, if it's used maliciously.

      I don't know that you know what the idea is here.

      There are systemic misuses and outright exploits. I am sure that any new system has both.

      There is nothing new about this "system". It's just another computer program.

    8. Re:Ha!!! by Anonymous Coward · · Score: 0

      And Flash differs how?

      Flash is a browser plugin that is installed on the majority of web surfers' machines. PHP is a scripting language that usually runs on web servers. It is not installed on the majority of web surfers' machines, does not work as a browser plugin, and is unsuitable as a browser scripting language in its current form. Really, you'd think somebody who claims to teach the stuff would know this.

      And who controls how this is used over the net?

      The users. Suppose a) PHP was modified to run in browsers, and b) PHP was made safe enough to do so, and c) you managed to get a decent number of people to install it. If it was used in an annoying way, you could simply disable it, like you can with Flash. The world doesn't end.

      This is going to be misused, imho.

      This is going to be misused? This is going to be misused? This extension that doesn't allow websites to do anything new to their visitors is going to be misused? Your opinion had better be damn humble.

      Wherever they come from, be it the client or the server, they could still be malicious and misused.

      Yeah, the same's true of any code anywhere. But this doesn't allow code to sneak onto your system in any way.

      Couldn't I just have read the article and made informed conclusions about it, in that this appears to be innocent now, but could be misused by bad people / bad companies?

      You do not have "informed conclusions" from what I can tell. Your only misuse scenario I have seen is rendering OpenGL scenes in browsers on behalf of websites. This project doesn't do that in any way, and if that was your goal, there are far better ways of going about it.

      this project appears harmless, but it could be manipulated maliciously.

      Give me a single example that makes sense. A single example of misuse.

      Why are you defending it?

      I'm not, I'm rebutting a clueless fool who is trying o tell others the sky is falling. The project itself isn't that interesting to me as I don't use PHP for client-side stuff.

      laughter is hard to control when I read statements like yours.

      Is it also hard to control your fingers typing it out?

    9. Re:Ha!!! by Anonymous Coward · · Score: 0

      Why would he want to say that he is a moron?

    10. Re:Ha!!! by Anonymous Coward · · Score: 0

      This process is still young, but the eventual direction this will take is 3d apps over PHP and the web. It's bound to go that way. How could you deny that?

      You're the one making the outlandish claims; the burden of proof is upon you to prove it to us. Explain how we get from today to your described situation.

      You sound like Bill Gates when he said that computers will never need that much memory.

      Bill Gates never said that.

      Currently, no, but that is bound to change when Gamespy figures out how to exploit this into Flash-like popup ads that can't be disabled, at all.

      If you knew anything about how the web works, you would understand that this simply can't be done. It requires something completely different to render OpenGL on behalf of websites.

      I think it's extremely viable for a plugin to be designed that will use this

      Please show me a) the people pushing for PHP in-browser, b) how they intend to get it installed on everyones machines, and c) how they intend to force you to keep it enabled.

      There are systemic misuses and outright exploits.

      Yes, and misuse implies that you are running untrusted code. Given that this doesn't give any new way to allow untrusted code onto your system, it boils down to "don't run bad stuff", the same as every other language under the sun. This is not a new attack vector.

      I'm saying he has triggered the inevitability.

      This isn't the Matrix, buddy. Saying stupid things like that is just as bad as the laughing. Grow up.

  64. The problem by mfh · · Score: 1

    > The guy did it for the hell of it. No one is proposing that we start using php for graphics coding. Just proving that we could if we wanted to.

    Yes, but we shouldn't use it like that. It's going to be exploitive if it is. It may be useful in some aspects, but I expect it will be misused by marketers, spammers (think 3d pr0n ads) and much more. I think it's going to be hell for many people. It could be invaluable for 3d gaming online, but it could also be totally misused, and because it's built into PHP, the users will have no choice but to go along with it.

    --
    The dangers of knowledge trigger emotional distress in human beings.
    1. Re:The problem by Anonymous Coward · · Score: 0

      because it's built into PHP, the users will have no choice but to go along with it.

      Yet another example of you not having a clue about what PHP is or does.

      The idea of a website rendering OpenGL scenes on client machines is not in any way advanced by this extension. Just because a server runs PHP, it doesn't mean that clients are forced to see OpenGL. PHP would have to be modified a great deal to run on client machines and you would have to get it installed on everyones computers for the doomsday you predict to happen. And guess what? The users could still just disable PHP in their browser And it wouldn't affect their ability to see PHP-on-the-server websites. The web just doesn't work that way.

  65. Incorrectly quoted (IIRC) by Phil+John · · Score: 1

    When the only tool you have is a hammer, every problem looks like a nail.

    --
    I am NaN
  66. Performance is irrelavant here. by HFXPro · · Score: 2, Insightful

    First I would like to point out that it is still making calls to OpenGL functions which were written in C (and asm most likely). Since PHP is a scripting language and in this case it is calling the OpenGL functions most of the work is being done in the OpenGL calls. Therefore it should run pretty well because most of the delay will be resulting from the C function calls. Scripting languages and all interpreter languages should do well even for simple scenes. They do slow down when you have a lot of logic going on however, such as updating a world model graph.

    --
    Reserved Word.
  67. Awesome! by Klowner · · Score: 2, Interesting

    This seems like a crazy idea, but it could seriously be useful. Making an online library of a huge pile of 3D models for example? That could greatly help game development projects.. Rather than opening model after model trying to remember which one is which, you could dump them all into a repository and have a handy-dandy php/opengl script generate little thumbnails for them all.. Awesome.

  68. Re:Cant wait till ads rely on my processor even mo by Moonpie+Madness · · Score: 1

    Oh.

  69. Re:The animation can't be interactive. by unixbum · · Score: 3, Interesting
    Could somebody who knows WTF they are doing tell me if it's possible without using an applet to get this to open a socket back?

    PHP has had client-oriented socket functions since PHP3. More recently, server-orinted socket functions have made it into PHP.

    Not to troll, but IMO PHP is a rapidly advancing language and a force to be reconcilied with.
  70. off topic by Anonymous Coward · · Score: 0

    say, you've written your own webserver, but you run it on a consumer-grade line, you think it's secure - but (because you're not an idiot) you don't know for sure, it's just for fun, to see if you could do it, etc...
    obviously, you don't post a link from slashdot. And you post anonymously! And you post where only a few will see, at first. But where can I get it checked out for serious use? Do I need 'credentials' b4 I can ask sourceforge to host something like that?
    peer review here ain't really up to the job.

  71. base64- and qp-decoding in 'just procmail' by Dr.Ruud · · Score: 1
  72. Yet another OpenGL binding by Zarf · · Score: 1

    If you want to make a name for yourself... pick a language without an OpenGL binding and write one for it. PHP seems particularily odd tho' ... Ruby gots OpenGL now... so how 'bout OpenGL for the BrainF*ck programming language? How 'bout OpenGL for bash?

    --
    [signature]
    1. Re:Yet another OpenGL binding by TimoT · · Score: 2, Informative

      Blatant plug: OpenGL and SDL bindings for Common Lisp: CL-SDL. And yes, I'm one of the authors. Most Common Lisps are compiled to native code; the performance is fairly good with the added benefit of having a high-level language to program with. There are also bindings to Haskell and OCaml AFAIK.

      TimoT

    2. Re:Yet another OpenGL binding by vidarh · · Score: 2, Funny

      It's mean to suggest something like that... Someone now WILL feel they NEED to write OpenGL bindings for BrainF*ck and Bash just because you suggested it and it's perverted enough.

  73. PHP CLI is our friend by Dr.Dubious+DDQ · · Score: 1

    I find it's especially useful for any application that involves "talking to a service over the network" or dealing with text-like (including html/xml) files and/or relatively simple GD-compatible graphics file manipulation (generating graphs, maps, etc.), whether it's a database server, a webserver, an ftp server, a socket, etc. etc.

    My own current personal project involves figuring out the "TIGER/Line" geographic data from the US Census bureau so that I can render the features at will over other existing map graphics and turn them into maps for GPSDrive. I've already got PHP scripts generating "USGS Topographic maps or TIGER/Line [1998 data rendered from the census bureau site] features rendered atop USGS Terraserver aerial photos" for GPSDrive...

    I've also considered doing a Kismet client class for PHP. Not real useful for old-fashioned web use, but could be handy for CLI (or PHP-GTK or whatever).

    And why not? It's fun.

  74. I've done this in JavaScript. by BigZaphod · · Score: 2, Interesting

    My JiggleScript project is a similar idea only using JavaScript as a base. I haven't released in awhile, but I've been working on it the past week or so and am nearing a point where I will be making another release--now with sound via OpenAL! :-)

    I get many hundreds of frames per second with my system on pretty moderate hardware (such as my 1Ghz G4 Powerbook). There is one script (not on the site, but a friend wrote it) that has about 200 boxes being rendered at a time (so about 2400 polygons) and my Powerbook still touches the 200fps range.

    Give it a shot. I'd love to get some people playing with and testing JiggleScript.

  75. What version are you using? by autopr0n · · Score: 1

    In mine, the js error only shows up as an icon in the system tray. I'll fix it through.

    --
    autopr0n is like, down and stuff.
  76. Watching the demo on GNU/Linux by KiDSSHoW · · Score: 1

    I just took a look at the opengl demo using wine.
    it works very nice.

    a simple "wine php.exe -- opengl.php" under Debian unstable.

    others may enjoy taking a look :)

  77. Re:Linux? by KiDSSHoW · · Score: 1

    works nice with wine...

  78. Re:The animation can't be interactive. by phreakv6 · · Score: 1

    There are NO client-oriented socket functions in php.what do you mean by that??.. fsockopen doesnt open a socket to the server from the browser.. !!

    --
    fifteen jugglers, five believers
  79. Not portable by xynopsis · · Score: 0, Redundant

    Although a cool hack, this is limited only to the Windows platform:
    $w32->RegisterWindowClass( $classname );

  80. erm by moro_666 · · Score: 1

    so we have a "simple" way to create opengl demos ?

    what's the point of an opengl application if it can't have threads nor can it have shared variables between the threads.
    how can you wait for a network packet (for example a opengl game that uses the net) and at the same time draw frames ? well ofcourse until some "limit" you can have one thread doing both. But losing network packets because your game can't render on the screen fast enough is a death of a netgame.

    php doesn't have threads and never will i think. they'd probably would have to rewrite most of the code to make it work.

    it's like you are building a house but are "forgetting" that it should have a roof, electricity and water support. ofcourse the livingroom will be easy to create with 3 lines but missing the rest it has no point.

    good luck anyway with it, it looks like a great util for creating opengl demos and movies which would be quite a hell to write in C from the beginning to the end.

    --

    I'd tell you the chances of this story being a dupe, but you wouldn't like it.
    1. Re:erm by mabinogi · · Score: 1

      > php doesn't have threads and never will i think. they'd probably would have to rewrite most of the code to make it work.

      and that would be a bad thing because........?

      --
      Advanced users are users too!
  81. usfulness? by POds · · Score: 1

    hmmm i've been sitting here trying to think what it would be usful for, but i realy cant think of anything. PHP hasnt really goten out of the web space much except for PHPGTK. Maybe these two projects could work together and do something? Maybe if there was a client side support for PHP in browsers this would be more usful, but appart from some small idea's people have mentioned, i dont see it being HUGE. But it is interesting.

    --


    Giving IE users a taste of their own medicine since 2005 - http://pods.-is-a-geek.net/
  82. -_- What a useless effort..... by Anonymous Coward · · Score: 0

    in my opinion, php was intended to be, and will always be, "server-side web programming language" and nothing else....if i have to do something outside the web server...then i'll use my old trustworthy buddy, PERL. Or even python. but not php.

    i admit that php is very easy to learn and *run*...but lacks some powerful features and other stuffs that general purpose langs other that php offers...

    btw, some p'ple believe in something stupid like php is way much faster than other programming langs because it runs faster than cgi. what a stupid, brainless thoughts.

  83. been there, done that... by Anonymous Coward · · Score: 0

    another method to do that: http://www.psikorp.com/php_glut/

  84. Eat my shorts Pearl boy......... by Anonymous Coward · · Score: 0

    ANY tool can be the right too. Can't we all just get along.

  85. Sigh by mfh · · Score: 1

    > Yet another example of you not having a clue about what PHP is or does.

    Inept. Totally inept statement. You missed my whole point, so I'll just skip it because I don't have time for people who don't understand simple logic.

    --
    The dangers of knowledge trigger emotional distress in human beings.
  86. Are you guys stupid or just geeks? by wsgeek · · Score: 1

    Why are you using PHP to do this? Were you bored?

  87. Heh by mfh · · Score: 1

    > Is it also hard to control your fingers typing it out?

    Sometimes.

    > Give me a single example that makes sense. A single example of misuse.

    For more information on that, go here.

    --
    The dangers of knowledge trigger emotional distress in human beings.
    1. Re:Heh by Anonymous Coward · · Score: 0

      I guess you completely ignored the bit about Flash and PHP OpenGL being completely different, huh?

  88. Why? by mfh · · Score: 1

    > I guess you completely ignored the bit about Flash and PHP OpenGL being completely different, huh?

    What's the point of rehashing this? I've already explained my view on the subject. To me, this PHP/OpenGL project brings the marketing people closer to a solution that will force bandwidth-intensive marketing down our throats. Even if the current state of PHP doesn't make it easy, the push for getting OpenGL to work using PHP brings it one step closer.

    PHP is a web scripting language, so it's only a matter of time before someone figures out how to take this project and transform it.

    --
    The dangers of knowledge trigger emotional distress in human beings.
    1. Re:Why? by Anonymous Coward · · Score: 0

      I've already explained my view on the subject.

      No you haven't. You've used Flash to support your argument that this will be used to do annoying things, but you haven't addressed the very pertinent fact that Flash and this project are completely different.

      Even if the current state of PHP doesn't make it easy, the push for getting OpenGL to work using PHP brings it one step closer.

      No it doesn't. PHP isn't used in client-side web scripting. Whether it can render OpenGL scenes or not is completely irrelevent.

      PHP is a web scripting language, so it's only a matter of time before someone figures out how to take this project and transform it.

      So in other words, your argument is if things were completely different, this has the potential to annoy people?

  89. Oh, the irony. by juhaz · · Score: 1

    Perl fan lecturing that language should promote, or better yet, ENFORCE, good programming practices? And blaming another language for that fault?

    If there's language that doesn't do that, it's Perl, if you need to name one language that has most unreadable code in the world written in it, it's Perl.

    1. Re:Oh, the irony. by runderwo · · Score: 1
      If you are deploying Perl code which was developed without 'use strict', you should be taken out back and shot. BTW, someone with something to prove can write unreadable code in any language they wish to discredit. Including PHP.

  90. Help! Help! I'm being Opressed! by Anonymous Coward · · Score: 0
    Your .sig (which you frequently change in order to troll Slashdot) currently says:
    I'm routinely modbombed for my opinions. The hivemind doesn't like the hegemony broken by free thought.
    No you're not being modbombed for your 'opinions', you're being correctly modded down because you're a fucking troll, a liar, and an MS shill. What you represent is not 'free thought' but deliberate misinformation and flamebait.

    But, having responded to your .sig, I can now honestly say that IHBT. Now that your Overly Critical Guy account is being modded down, you'll no doubt go back to trolling from your other account.

    HTH