JPG Loader for OpenGL

Hi all,
I have just started programming with OpenGL and wanted to know the procedure for loading a JPG file which will subsequently be used as a texture in OpenGL. Will I have to use an external file loader or if OpenGL has an in-built function for this purpose?

Thanks in advance

You can use libjpeg or if you want to manage several image formats and have support for transformations like flip, rotation, color space transformation like BGR to RGBA and so on you can use OpenCV.
Once you have the raw pixel matrix in memory you can use it as a texture.

Try DevIL: http://openil.sourceforge.net/

There’s a lighter alternative for JPEG:

http://nothings.org/stb_image.c

Check out the quake3 source code. They have a simple loader (I grabbed the tiff version, but haven’t converted the jpg one yet)…

Depends on your environment. If you’re on Windows GDI+ can load a JPEG and give you direct access to the pixels for uploading as a texture, and has the nice bonus that it’s not dependent on external libraries. If not, or if portability is a concern, grab one of the other alternatives already mentioned.