OpenGL in PHP 286
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.
PHP OpenGL on SourceForge (Score:5, Interesting)
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.
vsync (Score:5, Interesting)
Actually faster FPS (Score:3, Interesting)
Rendering 3D graphs of a slashdotting (Score:5, 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 [slashdot.org] and make it a remote application?
Re:vsync (Score:3, Interesting)
your mileage WILL vary (Score:1, Interesting)
Perfect application (Score:5, Interesting)
PHP Simple DirectMedia Layer Extension (Score:3, Interesting)
Usually doesn't get beyond the prototype though.
How about a new set off 'On Demand' products? (Score:5, Interesting)
- 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.
Re:Using the right tool for the job (Score:2, Interesting)
Sure you're not just prejudiced?
Re:Using the right tool for the job (Score:5, Interesting)
So why not php? What makes php a poor choice as opposed to say perl, python, ruby, vb.net or any other scripted language?
Very Cool (Score:0, Interesting)
Re:Running This (Score:3, Interesting)
For instance, Ruby's web application support has been rapidly gaining ground for quite a while now; fancy state-keeping systems [beta4.com] last seen on LISP; a powerful server framework [webrick.org] now integrated with the standard library; an innovative object-relational mapping library [rubyonrails.org] which makes interfacing with SQL databases childsplay; an interesting new web application framework [rubyonrails.org] which is causing quite a stir; an amazingly easy to set up Wiki server [instiki.org]; a nifty template library [brain-tokyo.jp] 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
Not to 'bash' or anything, but... (Score:3, Interesting)
Re:PHP OpenGL on SourceForge (Score:5, Interesting)
Interesting... (Score:4, Interesting)
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)...
Avoiding DLL Hell (Score:4, Interesting)
---
if ( is_file( "SimpleWndProc.dll" ) ? filesize( "SimpleWndProc.dll" ) != 2560 : 1 )
{
$dll = "eNrtVU9IFGEUf7NpTbZue1hCYqlvQT3JslsG0clt/aho1XHN
. "KDrYQTPJS1TUoWMEdSpYrEOEsQl66yD9gT1ILCHhIcqDML35
. "fe9733vffN+blu4p2AEAFQjLAsiBQ03wd3qD8B2c9sHT3fOh
. "TRwgKVFRVIP0SkQzFSIrpLmtgwyoaSlcXV1V68YYevv9/ZFn
. "80fXmUzKqT577k+5CBQgwWEluZm11AvgC+3hKr3gcQu0ye+C
[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. )
Re:Interesting... (Score:3, Interesting)
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.
Re:Using the right tool for the job (Score:2, Interesting)
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.
Awesome! (Score:3, Interesting)
Re:The animation can't be interactive. (Score:3, Interesting)
Not to troll, but IMO PHP is a rapidly advancing language and a force to be reconcilied with.
I've done this in JavaScript. (Score:3, Interesting)
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.