Image file types

Started by
12 comments, last by AAAP 18 years, 2 months ago
what files types can be loaded into opengl?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Advertisement
Anything you can find/make a loader for. OpenGL itself doesnt have any image loaders (glaux might?), you have to write them yourself(or download them like, SDL_image)

Hope that helps!
how would i make one for myself? is there a tutorial or maybe someone that could show me?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Its entirely dependent on the format...if you know the language your using well enough it shouldnt be a problem. You may have to do some research on the file format your wanting to use also.

If you dont know how to do that...then your best off using sdl_image or going to learn that language your using better.
i just got the SDL_image thing (since i use SDL anyway so it's all good), but i can't download the docs for it for some reason... is there another link for it?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Say i load an image:

SDL_Surface *image;
image = IMG_Load("image.png");

what do i do to that surface to bind it to a texture in opengl?

edit: by the way, this is using SDL_Image lib
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
ok, i found a site that had this:
GLuint texture;//Load BitmapSDL_Surface* bmpFile = SDL_LoadBMP("data/test.bmp"); /* Standard OpenGL texture creation code */glPixelStorei(GL_UNPACK_ALIGNMENT,4); 		glGenTextures(1,&texture);glBindTexture(GL_TEXTURE_2D,texture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,minFilter);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,magFilter); 		gluBuild2DMipmaps(GL_TEXTURE_2D,3,bmpFile->w,   bmpFile->h,GL_BGR_EXT,   GL_UNSIGNED_BYTE,bmpFile->pixels); //Free surface after using itSDL_FreeSurface(bmpFile);


i just have one question about glGenTextures()...
what's the first parameter for? at first i thought it was to specific the texture number; like if i put 1, then make another texture with 1, it would over write that... what's it for?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
You can easily use DevIL(OpenIL) to load most of the common image formats.
Here a link!
sweet!! i'm looking at that and it looks like i can do that thing i'm always wanted to do but couldn't, where i have a mapped texture, then when i load each tile i can write it to a separte texture, then when rendering i can just render that big texture instead of drawing every tile. will i be able to do that with OpenIL?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
i've been reading through the OIL docs and i saw nothing about loading an image with a keycolor... used for a transparent pixel color.. how would i do that then?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML

This topic is closed to new replies.

Advertisement