Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Mapping

Started by thedoofus May 22, 2006 at 7:51 AM 1 replies 450+ views
Original Post
thedoofus
thedoofus
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
Nairb
Nairb
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
griffin2000
griffin2000
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.