I could probably work out drawing code from an array, but how do I load an image into an array?

If anyone knows anything about the SOIL library, or a useable alternative, please help.

Thanks in advance

mikeynovemberoscar

Yann LE PETITCORPS

01-07-2010, 03:56 PM

You can load the tga file using a tga loader with something like

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=24

and make your terrain such as width x height quads when the (x,y,z) values of vertices are (x,y,imageData[y*width+x]) where 0<=x<width and 0<=y<height.

The imageData[y*width+x] is now the height of the vertex at the position (x,y)
(but this work only with a greyscale file, with a rgb file you can handle something like a displacement map with x,y,z=r,g,b )

Something, it's exactely the type of things that I project to make using geometry/vertex/fragment shaders and/or instanciation or something like this for to can use a basic quad (or very more that only one ...) where I can easily bumpmap and display a video stream on it (for to handle realistics animated waves for example).

@+
Yannoo

mikeynovemberoscar

01-08-2010, 09:45 AM

Thankyou very much, this was just what I was looking for. I read one nehe tutorial which was designed for windows and just assumed they were all.

P.S. I'm a MAC

Yann LE PETITCORPS

01-08-2010, 01:36 PM

There is a Mac OS X/Cocoa version at the end of the page.

And you can too use gcc and/or g++ with a makefile on MacOS

Here is a makefile that I use with gcc and g++ on the MacOS plateform with SDL, GLUT and AVCODEC libraries