Jump to content

Recommended Posts

Nope. DirectX only works on Windows, and isn't even remotely pat of PHP. DirectX is also more geared towards real-time graphics acceleration, not at creating static 2d images.

 

If you *really* wanted to use DirectX, the easiest way I can think of would be to setup 2003 server with PHP, then create your image generating program in a language that supports DirectX, the communicate back and forth with it with PHP / databases.

 

And yeah, what images are you creating? Are you sure it is GD2 that is slow, and not just your server or your download time? I doubt DirectX would be any faster, since not only are you going to have to write the whole surface as a bitmap, and then convert that to a web format, your going to have to initalize DirectX... DirectX also isn't going to just let you run concurant instances without screwing up either.

Link to comment
https://forums.phpfreaks.com/topic/114587-directx/#findComment-589306
Share on other sites

because the gd library has practically nothing except a function for writing 1 pixel and a time.. do you know how many times that has to be called in a loop to make a decent sized (E.G. 1680x1050) image? ya.. the function call overhead alone kind of kills it.. not to mention that php isnt a graphics api, so actually, you know, making an image.. ya.. really slow (unless it's tiny)

 

so if anyone knows of a decent image library for php, please post it, thanks

 

its okay if its windows only(needs wine)

Link to comment
https://forums.phpfreaks.com/topic/114587-directx/#findComment-589351
Share on other sites

I don't think anybody is really arguing that the GD library is very "limited;" the real point we're trying to make is that php was not really designed for graphic application. It's a server side language, used for interacting with databases and files and producing dynamic output.  Are there other miscellaneous and creative uses for PHP? Sure.  But that's not it's primary function.

 

And when you think about it, all graphic application functions boil down to writing things 1 pixel at a time.  Other languages or engines just make it easier for you. They give you the programmer extra functions to say, draw a line starting from x1,y1 to x2,y2.  But internally, it's really no different than you having made some loops and conditions to print (or not print) it pixel by pixel.  And they also do it a lot faster because they are designed to make use of lots of RAM and graphics cards, etc.. on a computer more suited for graphic application.  A server is not the same as some random Joe's computer.  Well I mean, it's a computer, but it doesn't need things like graphics cards. 

 

So you see, it's not really php's fault.  It just doesn't have prefab functions to make life easier for you, even though those prefab functions don't really do anything that php can't.  It's more the environment it's being run in.  The bottom line is that if you want to do something with heavy graphics, you're going to have to use a more "traditional" language like c++, vb, java, delphi, etc...

 

I mean hell, if you're really bent on doing it with php, you could write your own extension for it.  Hell, you can even make it interact with directX or <insertsomegraphicsenginehere>.  But like I said, it's not really php that's the culprit here, it's the fact that it's being run on a server.

Link to comment
https://forums.phpfreaks.com/topic/114587-directx/#findComment-589696
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.