I need to know how to open/read an rgba file in C on a unix box, and then texturemap it to a sphere.
First one to answer gets… well, nothing, but I’ll appreciate it.
Thanks,
Tha’ Moo.
I need to know how to open/read an rgba file in C on a unix box, and then texturemap it to a sphere.
First one to answer gets… well, nothing, but I’ll appreciate it.
Thanks,
Tha’ Moo.
their are probably librarys you can download but here is the specs
http://www.wotsit.org/download.asp?f=sgiimage
you should also search sgi’s website for info as the .sgi format is the same thing and I know they release dll’s for free for windows I would expect that they would for unix
After some research I found a function to do it (although it is untested). It is not mine, so you must check out whether you may use it or not…
here is the link
http://www.cs.utah.edu/classes/cs5610/
specifically here and here and here http://www.cs.utah.edu/classes/cs5610/assignments/lab2/texture.c http://www.cs.utah.edu/classes/cs5610/assignments/lab2/texture.h http://www.cs.utah.edu/classes/cs5610/assignments/lab2/example.c
Many thanks
Paul Bourke, master programmer published these …
Loading 32 bit targa images (with source code) : http://astronomy.swin.edu.au/pbourke/dataformats/tga/
Loading 32 bit SGI images (with source code) : http://astronomy.swin.edu.au/pbourke/dataformats/sgirgb/
If all u want is to texture map a sphere with a rgba image, then that is easy.
Just use glTexImage2d(GL_TEXTURE_2D, //target
0, //Level Of detail.
4, // RGBA
width,
height,
border,
GL_RGBA, // format
GLUBYTE,
image // The actual data
);
If u want to read a rgba image, u can use glReadPixels(…);