I am building a site in HTML5 for my client and it must run on the iPad/iPhone (i.e. Safari on iOS).

They want a 3D effect where they have a simple, yet, specific product they want to show on the site in 3D with user generated data as the texture.

Normally, I would use either flash/silverlight/webgl but these are not supported on iOS.

Also, CSS 3D transforms are close, but since I need a specific shape and size, creating hundreds of div elements and transforming them just wont work in the long run.

My idea, is to use server side code to generate a sprite sheet that could be used on the site to fake the 3D-ness of the object.

What I really lack is the knowledge around DirectX/OpenGL in order to automate this process.

My question is, can I use DirectX/OpenGL from a command line (or programatically) to pass is a model and textures to generate a PNG/JPG sprite sheet of a rotating object?


Unfortunately, no. At least not in the way you propose it.

DirectX and OpenGL are not programs, but libraries you can use to develop your programs. In fact, they are quite low-level, and even seemingly simple tasks such getting a simple model to be displayed on the screen, are by far not trivial when using these libraries.

In that sense, there is no "command line version" of DirectX or OpenGL.

However, there are many rendering tools you can probably use for your purposes. If you have 3D modeling experience, then Maya, 3DS Max or Blender are all very good choices. If you don't, then Google SketchUp is very easy to learn.

All of these programs support exporting a model to a bitmap, and they probably support doing so from the command line, you should check that tool's documentation to see if it does what you want.

  • \$\begingroup\$ thanks for the answer Panda, I just had a look at Blender and it looks like it supports what I want actually, but I still need to investigate further \$\endgroup\$ – Mark Apr 9 '13 at 23:27

You can write such a tool yourself. By default, DirectX renders to a render target. This target is just a piece of memory and you can get those bytes and then save that as a file. Or you can display them on screen.

If you could set it up as a service, you could invoke the service and it would serve png images. Albeit it might be slow :)

  • \$\begingroup\$ Thats a good idea, but probably a little out of my skill level, but someone else could probably do that. \$\endgroup\$ – Mark Apr 10 '13 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.