Archived

This topic is now archived and is closed to further replies.

This topic is 5753 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Can anyone give me some code for loading a .jpg image into OpenGL? -Fredric

Share on other sites
Use DevIL. It supports lots of image file formats:
openil.sourceforge.net

Gero

Share on other sites
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

Share on other sites
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 =-

Share on other sites
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.

Share on other sites

  // 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

Share on other sites
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

Share on other sites
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

Share on other sites
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 =-

Share on other sites
>>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

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 23
• 11
• 11
• 9
• Forum Statistics

• Total Topics
631768
• Total Posts
3002242
×