Sign in to follow this  
thedoofus

Texture Mapping

Recommended Posts

Hey - I'm hoping this is a really basic question - but I'm trying to implement texture mapping into my ray tracer. I know how to get my UV co-ords and all that jazz, but I haven't a clue how to read the rgb values into my program. It really is that basic. I'm hoping theres a simple fscanf kind of function around but can anyone give me any answers or directions into where to look? I'm using C programming. Cheers, HH

Share this post


Link to post
Share on other sites
If I understand your question right, it depends on the format the texture is in.
I believe there's a document on loading BMP files somewhere on this site that can help. Another altnerative is to use some library like FreeImage, which will do the image loading for you and provide you with a memory buffer containing the pixel data.

Edit: Though I'm not sure if FreeImage is C or C++. Haven't really used it.

Cheers,
--Brian

Share this post


Link to post
Share on other sites
There are alot of different libaries or example code for specific image formats:

PNG - http://www.libpng.org/pub/png/libpng.html
TIFF - http://www.libtiff.org/
BMP - http://astronomy.swin.edu.au/~pbourke/dataformats/bmp/

ImageMagick supports several formats:
http://www.imagemagick.org/script/index.php

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this