Advertisement

Image File Formats

Started by December 12, 2004 01:54 AM
1 comment, last by lc_overlord 19 years, 11 months ago
Sorry to be talking about this, however i dont even really know what to search for lol. But anyway, as i was told in a recent post ( http://www.gamedev.net/community/forums/topic.asp?topic_id=287626 ), images are just arrays in the data type "char" correct? However that is basically all i know, can someone point me in the right direction for searching or possibly links on the steps to load images? I understand you have to know the file format, however even for the simple loader displayed in the link above i am lost. I do not get this texturing process

  glBindTexture(GL_TEXTURE_2D, ID);
   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
and junk like that.. I dunno, can anyone just give me something? anything? a link? because i loaded that, with somewhat unexpected results but even at that, i much need to learn what all this is about. Thanks for any useful replies to this helpless idiot lol, and sorry for such ignorant posts :/
Rank: OpenGL & Glut "Nub", C++ Freshman.
for your question on loading images, here is a simple .tga loader with a nice explanation. as it says, targas are images with an alpha channel, so they can have transparency.

for your question about opengl texture generation, the best source i can point you to is thegametutorials texure mapping demo, whose source is commented extremely well. it should clarify many if not all of your questions about texture mapping. they do use the glaux library to load bitmaps, but you should be able to substitute your own loader in instead(it also doesn't use Glut, but that shouldn't be a problem either). the specific function is CreateTexture in Init.cpp, while an overview of the entire texturing process can be found in the comments at the bottom of Main.cpp.

if you get confused on what a specific opengl function does, just google for it. and, if all else fails, just use glaux.

cheers.
- stormrunner
Advertisement
www.wotsit.org - for the image file formats
www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html - openGL referece pages for all your ogl needs
nehe.gamedev.net - lot's of tuturials, even some on texturemapping.

This topic is closed to new replies.

Advertisement