View Full Version : Use BMP, PCX, TGA, JPEG for textures
03-12-2001, 05:21 AM
I search free librairies or free classes who permit to import textures in OpenGL applications. Now I'm using RGB format but it is hard to find software for making drawings in RGB format.
So if you now a program (free always) who convert BMP, PCX, or TGA files in RGB format. Exist 3Dexploration but it do only the conversion in the contrary sens.
Thanks for help. http://www.opengl.org/discussion_boards/ubb/smile.gif
03-29-2001, 10:12 AM
void setup_texture(char *filename, GLuint texobj, GLenum minFilter, GLenum maxFilter, int xs)
// Load texture from tga-file..(32 bit.. )
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, maxFilter);
FILE *f = fopen( filename, "rb" );
MessageBox (0, filename, "File Open Error", 0);
assert( f );
fseek( f, 18, SEEK_SET );
unsigned char *buf = (unsigned char*)malloc( xs * xs * 4 );
fread( buf, xs * xs * 4, 1, f );
// alpha-wert setzen...
for ( int i = 0; i < xs*xs; i++ )
fclose( f );
glTexImage2D( GL_TEXTURE_2D, 0, 4, xs, xs, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, buf );
03-29-2001, 10:41 AM
OpenIL is one of many available image loading libraries that are freely available.
03-29-2001, 10:50 AM
hm openIL is stupid.. they forgot a nice little function:
IMG* myimg = loadIMG( "mypic.xyz" ); //xyz representing the fileformat
i dont want that they handle it like textures so that you cant access them directly.. thats just stupid.. i dont need any more functions than THIS ONE!
(hm.. i just have problems to get the gimp functions to work.. then you can download it on my server)
>>IMG* myimg = loadIMG( "mypic.xyz" ); //xyz representing the fileformat
i dont want that they handle it like textures so that you cant access them directly.. thats just stupid.. i dont need any more functions than THIS ONE!<<
check the docs its possible to have access to the images data directly so u can do the gl texture creation yourself. or with openil so all you need is one line to simply load + bind a texture. ive done both so its possible.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.