views:

414

answers:

6

If one wanted to program a game in an unusual language, but no library or functions exist to manipulate graphics, how would this be accomplished? By writing your own low level routines?

+2  A: 

By interfacing to OpenGL, it's graphics-card independent API.

For a concrete example of what that means and how it's done, have a look at the OpenGL bindings for Python

Look here for bindings to other languages.

Why do you have to do this?

Well, graphics programming is highly dependent on the hardware (i.e. graphics card), and there are many of them. OpenGL is the standard language that they all understand. (I think the same can be said about Direct3D, but that's owned by Microsoft, while OpenGL is more open).

hasen j
A: 

Conventional wisdom would suggest to "use the best tool for the job", if there are no existing libraries to manipulate graphics for your language, it's likely not the best tool for the job.

ermau
+1  A: 

If you plan to use graphics hardware, you need to have its drivers and OpenGL or DirectX.

Crashworks
+6  A: 

You are standing by a house. A road runs off to the east, and south there is a narrow path leading around the back of the house.

There is a mailbox here.

What do you do? _

mjfgates
This assumes no graphics capability for the target platform.
hasen j
Go South...screw the grue.
EBGreen
+1  A: 

If you're programming this for some exotic piece of limited hardware, there's only so much you could do. If you're simply not given access to draw to the screen other than in some extremely limited manner (perhaps all you can do is render a string of text), then there's nothing you can do.

If you're doing this on an ordinary computer but your language of choice simply doesn't have any OpenGL or DirectX bindings, then you'll need to write some yourself.

Zach Conn
+3  A: 

Find out how it interfaces with C libraries, then use that to make an interface to OpenGL, DirectX, or OpenAL. Alternatively you can port something else, like say SDLlib. In a weird case you might want to embed a language that has the library you'd like. Say if it's Java3D and you want to compile it with Mono 2.2. I'm not sure that's even possible, but one of the mono-project changes is Java support. Of course on Mono you have other game library options.

dlamblin