Loading a jpg into OpenGL..?

Started by
8 comments, last by FDGaming 21 years, 6 months ago
Can anyone give me some code for loading a .jpg image into OpenGL? -Fredric
-FDGaming(CEO, Lead Programmer)
Advertisement
Use DevIL. It supports lots of image file formats:
openil.sourceforge.net

Gero
Graak, there''s too many files in DevIL, I can''t make any sense out of them. :S And even then, I wouldn''t know how to get the info into an OpenGL texture...

Is there anything else you know of?

-Fredric
-FDGaming(CEO, Lead Programmer)
go to gametutorials.com, then tutorials, and choose opengl, go to page two and download the tutorial(source comes with it) on makeing a texture map out of a jpeg, it shows how to load the jpeg using the independent jpeg groups library, hope it helps

,Matt

-= kill one your a murderer, kill thousands your a conquerer =-
-= kill one you're a murderer, kill thousands you're a conquerer =-
if you dont want to do the slight bit of work to load a jpeg with devil why even try to do it in the first place? you never will unless you do SOME work. You could also use the Intel Jpeg Library (ijl) but that might be harder for you to use and you have to get it somewhere else then intel as they dont offer it free anymore.

If i were you i would just forget it and move on. load .raw or something. try using unrarlib http://www.unrarlib.org/ and compressing you .raw or .tga file and just load those. dont expect things to be handed to you and the knowledge of how to use them instantly pop in your head.

  // Thats all to load a jpg file with DevIL - questions?!ilGenImages(1, &m_uiImageID);ilBindImage(m_uiImageID);ilLoadImage(szFilename);glGenTextures(1, &m_uiTextureID);glBindTexture(GL_TEXTURE_2D, m_uiTextureID);ilutGLTexImage(0);  


Gero
Thanks Samsosa.

Anonymous Poster- I have to write this for other peoples comprehension as well, since I''m working on a team project. I have no problem with doing work, just when that work will take a few days, and there''s obviously an easier solution.

-Fredric
-FDGaming(CEO, Lead Programmer)
I REALLY doubt that loading jpeg''s with the library samosa mentioned is easier than using DevIL. Correct me if I''m wrong (and show me the source)...

Gero
i dont know if its easier, it is more code, i know that, personally id like it to be a bit more code(a bit is kind of an understatement ), so i know whats doing what, rather just than blindy using someone elses code, he''ll learn more with ijgl, in terms of simplicity i think that from what uve shown devIL is less code. I think that the original poster was griping about the amount of files that devIL has, as opposed to ijgl which is only one .h file, if theres more code to work with he can tweak it ,once he becomes better at handling image file formats, to suite his needs. that way he(and his team) will learn how to use jpegs as textures instead of learning how to cut and paste

,Matt

-= kill one your a murderer, kill thousands your a conquerer =-
-= kill one you're a murderer, kill thousands you're a conquerer =-
>>ng about the amount of files that devIL has, as opposed to ijgl which is only one .h file,<<

i have looked at devil for a while but i believe u only need to include 1 or 2 headers

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement