   Accessing individual pixels of texture
  Hello everyone. I've modeled something in opengl. I have also applied textures. It is very important for me to access the matrix of my loaded texture, but i can't figure out how to do it using the codes that i used in my project(which i got from NeHe)Here is the code, i need to access the texture 'matrix' somewhere, please helpAUX_RGBImageRec *LoadBMP(char *Filename){FILE *File=NULL;// File Handleif (!Filename)// Make Sure A Filename Was Given{return NULL;// If Not Return NULL}File=fopen(Filename,"r");// Check To See If The File Existsif (File)// Does The File Exist?{fclose(File);// Close The Handlereturn auxDIBImageLoad(Filename);// Load The Bitmap And Return A Pointer}return NULL;// If Load Failed Return NULL}BOOL LoadGLTexture(GLuint *texPntr, char* name){BOOL success = FALSE;AUX_RGBImageRec *TextureImage = NULL;glGenTextures(1, texPntr);// Generate 1 textureFILE* test=NULL;TextureImage = NULL;test = fopen(name, "r");// test to see if the file existsif (test != NULL) {// if it doesfclose(test);// close the fileTextureImage = auxDIBImageLoad(name);}if (TextureImage != NULL) {// if it loadedsuccess = TRUE;// Typical Texture Generation Using Data From The BitmapglBindTexture(GL_TEXTURE_2D, *texPntr);glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage->sizeX, TextureImage->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);}if (TextureImage->data)free(TextureImage->data);return success;}   
  TextureImage->data should be a pointer to your texture. Then you can accesto a pixel calculating the position of the pixel in the array of pixels.TextureImage->data[0] (Component R of the first pixel)TextureImage->data[1] (Component G of the first pixel)TextureImage->data[2] (Component B of the first pixel)TextureImage->data[3] (Component R of the second pixel)TextureImage->data[4] (Component G of the second pixel)TextureImage->data[5] (Component B of the second pixel)...Well, i said you have to calculate because the texture really its a matrixof pixels.So TextureImage->data[0] is the R component of  pixel [0][0] of the matrixTextureImage->data[3] is the R component of pixel [0][1] of the matrix...TextureImage->data[TextureImage->sizeX*3] is the R component of pixel [1][0]TextureImage->data[TextureImage->sizeX*3+1] is the R component of pixel [1][1]...I hope i'm not wrong and this can help you   ;  Sorry, when i saidTextureImage->data[TextureImage->sizeX*3+1] is the R component of pixel [1][1]should sayTextureImage->data[(TextureImage->sizeX+1)*3] is the R component of pixel [1][1];  Thanks a lot and i'll try it   