🔒 Locked
Image file types
Advertisement
Original Post
what files types can be loaded into opengl?
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!
Hope that helps!
how would i make one for myself? is there a tutorial or maybe someone that could show me?
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.
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?
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
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
ok, i found a site that had this:
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?
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?
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?
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?
Quote:
Original post by EvilKnuckles666
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?
It denotes the number of texture objects generated by opengl, which are stored in an array, the pointer to the first element of which you provide in the second parameter.
/edit: Forgot the most important thing [smile] ... so in other words, you can use 1 as many times as you want.
And about the image loading thing, I have used SDL_image, and it's good but since it has to support a large number of file formats, I found it a little bloated (with 3 or 4 dll's having to accompany the executable). You will realistically) only need support for 1 or maybe 2 formats, and you're perhaps better off writing the loader to that yourself. TGA is a format that supports an alpha channel, the compression algorithm is extrememly simple and is on the whole very easy to parse,
Go to wotsit.org for file specs.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement