Slashdot Log In
OpenGL in PHP
Posted by
michael
on Tue Jun 08, 2004 05:20 PM
from the they-said-it-couldn't-be-done dept.
from the they-said-it-couldn't-be-done dept.
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.
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
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.
Re:PHP OpenGL on SourceForge (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.
Parent
Re:PHP OpenGL on SourceForge (Score:5, Informative)
Parent
Re:PHP OpenGL on SourceForge (Score:5, Funny)
Parent
Re:PHP OpenGL on SourceForge (Score:5, Interesting)
Parent
Re:PHP OpenGL on SourceForge (Score:5, Funny)
Parent
Re:PHP OpenGL on SourceForge (Score:4, Funny)
Parent
Running This (Score:5, Informative)
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.
Re:Running This (Score:4, Funny)
PHP-GTK baby.... GTK apps written in php..
Soon php will be used for all kinds of innapropriate uses!!
Viva PHP!
Parent
What about (Score:4, 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 [gamedev.net] about this yet? I did a text search of the front page but nada (I haven't been to the site in months).
Parent
Re:Running This (Score:5, Funny)
OOooooooh, FACE!!
Parent
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
Re:Running This (Score:5, Funny)
1. Read story on Slashdot.
2. Download
3. Unzip file.
4. Execute unknown code.
5. ????
6. Pray.
Is that about it?
Parent
Re:Running This (Score:3, Funny)
my favorite game... (Score:3, Funny)
Re:my favorite game... (Score:4, Funny)
Parent
Using the right tool for the job (Score:5, Insightful)
Of course, we already knew this. [php.net]
Re:Using the right tool for the job (Score:5, Funny)
Parent
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?
Parent
Re:Using the right tool for the job (Score:5, Insightful)
Because you don't have to be a "guru" a la Perl to right functional programs with it. Same reason people here hate VB.
Parent
Re:Using the right tool for the job (Score:5, Insightful)
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.
Parent
Re:Using the right tool for the job (Score:5, Insightful)
so is Brainfuck [muppetlabs.com], but i wouldn't consider it the right tool at any time.
Parent
Re:Using the right tool for the job (Score:3, Informative)
Re:Using the right tool for the job (Score:4, Insightful)
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.
Parent
Practical uses for this technology (Score:5, Funny)
Re:Practical uses for this technology (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.
Parent
vsync (Score:5, Interesting)
Re:vsync (Score:3, Interesting)
Correct me if I'm wrong, but... (Score:5, Informative)
Do not be fooled by this (Score:4, Funny)
Hrm.. (Score:5, Funny)
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?
Perfect application (Score:5, Interesting)
Re:Perfect application (Score:4, Informative)
Parent
PHP Simple DirectMedia Layer Extension (Score:3, Interesting)
Usually doesn't get beyond the prototype though.
Not to 'bash' or anything, but... (Score:3, Interesting)
Two words... (Score:4, Funny)
--
This sig doesn't do windows
This is NOT Server-side (Score:5, Informative)
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.
And I say, (Score:4, Funny)
uh, you read that wrong (Score:5, Funny)
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.
Cant wait till ads rely on my processor even more! (Score:3, Funny)
awesome (Score:4, Informative)
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)...
Not an implementation, but a binding (Score:5, Informative)
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.
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:Practical use (Score:5, Informative)
Parent
Just a wrapper (Score:4, 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 [sourceforge.net].
Parent
Re:Mod parent down. (Score:5, Funny)
Hi, welcome to Slashdot. You must be new here.
m-
Parent