Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

OpenGL Image file types

This topic is 4674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
ok, i found a site that had this:

GLuint texture;
//Load Bitmap
SDL_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 it
SDL_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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!