• ### Announcements

#### Archived

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

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

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627653
• Total Posts
2978433
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 10
• 12
• 22
• 13
• 33