How to load texture from common picture formate?


  So far I only can load texture from PVR file according to the following API.



Could I load texture from common picture formate such as *jpg, *bmp, *png and so on ?


Does anyone have the similiar experience about this question ?


Thank for your help.

You can load from other file formats, but you lose any advantages of the different texture formats that OpenGL ES allows you - i.e. everything will be 32bpp RGBA8888 or 24bpp RGB888 which is far from optimal for most situations. Compared this to 2bpp or 4bpp PVRTC, for instance.

The procedure would be:

- open file

- read/decompress data -> RGBA8888

- pass to GL

The only advantage to be gained is in storage size (at least for png and jpg) and these formats can come directly from other sources than PVRTexTool.

All the formats you mention can be converted to .PVR via PVRTexTool and with a little scripting this can be done automatically - see the SDK examples.

Do you have a particular reason that you want to load directly from these formats?


  As you mentioned before,I know that I could convert .PNG (or .JPG) to .PVR via PVRTexTool in the SDK examples.


Why do I want to load from these formats(*PNG or *JPG) directly?

I would like to load those picture as texture directly.

because those picture(*PNG or *JPG) were generated at run time.


if I could load picture directly, I will save time.

Because I don't need  to spend time converting picture(*PNG or *JPG)  to .PVR file.


If it's possible,I want to load picture(*PNG or *JPG)  directly.

If it is not possible.I only can load PRV file by converting picture to .PVR file.


Does anyone have any idea about this question?

Thank for your suggestion.






As I say above: the procedure would be:

- open file

- read/decompress data -> RGBA8888

- pass to GL

For instance: to read and decompress the data from a jpg, for instance, there are various libraries available in source:

Hi Gordon,

   Could I confirm the precdedure?

 using PVRTexTool v3.10

Step1:  File-->Open-->image.jpg

Step2:  Edit-->Encode-->RGB888



Does Step 1 map to - open file
Does Step 2 map to - read/decompress data -> RGBA8888
what is pass to GL?


Could you please tell me more detail?


Thanks for your help.



  I have read the article " Load BMP file in runtime" in this forum.

it memtions about using DevIL.

we could load a .bmp(*jpg or *png) file as texture in runtime without converting into .PVR format.

Is the above describtion correct?

Or I just misunderstand it.






on page 6 in the PVRTexTool.Reference Manual.1.11f.External.pdf

An image file of the format (BMP, TGA, GIF, PCX, JPG and PNG). MIP-map information will
be discarded when these formats are chosen – use Save MIP-level from the Edit menu for
this functionality. A decompressed version of the encoded data that will be saved.


According to the above step,I would save original bmp as new bmp file.

This is what you memtion before.




If you want to use .jpg or .png or other image formats directly on your device then PVRTexTool can’t help you.

You will have to write your own code to read these formats and then load the image data into OpenGL.

The steps I described are the steps that your code would have to perform in order to do this.

Thank you for your explanation.


Maybe I don't express my question clearly.

What I want to confirm is that you had posted.

PVRTexTool can't help me to use .jpg or .png or other image formats directly on our device.

We have to write our own code to read these formats and then load the image data into OpenGL.


Thanks for your suggestion and help.

According to your suggestion,I will try it.


Thanks. Smile

Yes, that’s correct.

Hi Gordon,

   According to your suggestion,I can use bmp file as texture directly base on SDK example.


Thank you for your suggestion.