Get pointer to an image


i want to load texture for an openGL Application under BeOS/Haiku, but i don’t want to use external libraries such as libpng, libjpeg, …

Is there an api under the BeOs API which could allow me to load an image (.bmp, jpg, .png, …) and get its pixel data pointer ?
(like OLE IPICTURE under Windows).

There can i found info about that ? ( what can i put in google ?)



May be you can look for information about the BeOS’ Translation Kit API.

A BeBook mirror is in this address:

Hope it helps.


Yes there is. Look under the Translation Kit in the Be Book. The best way (IMO) to just load an image and get on with things is to include TranslationUtils.h and call BTranslationUtils::LoadBitmapFile().

Ok. Thanks. I will try it.
Which file format does it support ? I haven’t found any list in the documentation (.bmp ? .gif ? )

It depends on what translators are installed. Haiku currently has translators for BMP, GIF, JPG, JPEG2000, PNG, PPM, SGI, TGA and TIFF images. BeOS probably has a similar list, plus there are more which can be installed from BeBits.

Is it installed by default on all version of the operating system ?
What are the file format which are installed on 100% of BeOS and Haiku ?

I want to use a library which is available on every operating system (even if it only support .bmp). i don’t want someting which depends on other things like it’s the case for Linux. I am interested on Haiku because i want a free operating system and i hate all the dependencies of Linux.

The Translation Kit, which comes as library is installed and available on 100% of BeOS compatible system: BeOS, Zeta, Haiku.
So you should not worry about your program being able to use this system library.

But alone this library does nothing helpfull. It needs “translator” add-ons to offer and do the actual data translation (as this kit is not limited only to “image” data…). The builtin image translator add-ons list is not exactly the same on each system, but I guess you could bet that BMP, TIF, TGA & JPG are always available among them.
I don’t remember if PNG was a default translator in BeOS R5, but if it was not I’ll bet that since old R5 days every user that still use BeOS, Zeta or (how fool! ;-)) Haiku have installed it.

Philippe Houdoin, occasional OpenGL & Networking team leader :wink:

If it’s just a BMP in OpenGL you want, you could always just load it yourself:

Sift through the code at the above link (Theres a bunch of downloads at the bottom).

Mathew Schofield
"Show me someone perfect, and i’ll show you an idiot."

Does this add-ons have to be installed be the user ? (like a codec)
Is it just DLLs ? (Like GTK or DirectX under Windows)
Where can the user find it ?
How to install it ?

Sorry but i am a beginner in BeOS/Haiku. But very interested.
Where can i find an introduction to the BeOs world and what are translators and how it work and other things ?

Have a look at the BeBook, as robmx suggested in the first reply:
It’s all there.