Loading Jpegs

Started by
5 comments, last by Shai 19 years ago
Does someone knows an algorithm which loads jpeg files in a programm?
--- we hit the highscore ---www.Gamag.org
Advertisement
you need to get the file format and use that to load the jpeg
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                          
Looking for video game music? Check out some of my samples at http://www.youtube.c...ser/cminortunes            
                                                          
I'm currently looking to create music for a project, if you are interested e-mail me at cminortunes@gmail.com    
                                                          
Please only message me for hobby projects, I am not looking to create music for anything serious.
?? could you explain that
--- we hit the highscore ---www.Gamag.org
http://www.realityflux.com/abba/C++/SXMLEngine/SXMLEngine.zip

Look into ImageUtils/Image.h/.cpp and AppUtils/Texture.h/cpp
#include <SDL/SDL.h>#include <SDL/SDL_image.h>void LoadTexture(Model &model , const char *tex){	SDL_Surface *texture = IMG_Load(tex);	if(texture)        {		/* create texture */		glGenTextures(1, &model.tex_id);		glBindTexture(GL_TEXTURE_2D, model.tex_id);		/* load in texture */		glTexImage2D(	GL_TEXTURE_2D , 0 , 3 ,				texture->w , texture->h , 0 , GL_BGR,				GL_UNSIGNED_BYTE , texture->pixels);		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);				SDL_FreeSurface(texture);	}	else	{                // should throw		cerr << "error : loading texture " << tex << "\n";	}}

will load any image format
Another one is, if you need to use JPEG's as OpenGL textures, you can use NeHe's IPicture code, which can even load JPGs from the net [smile].
DevIL library
"It's better to regret something you've done than to regret something you haven't done."

This topic is closed to new replies.

Advertisement