   Help, Targa texture not binding
  For some reason, the texture isn''t showing - I had it working after a fashion - you could see a box that was colored some sort of blue.  now you can''t see anything   Heres'' teh source :   #ifndef TEXTURE_H#define TEXTURE_H typedef struct{GLubyte *imageData;GLint idLength;GLint colorMapLength;GLint bytesPerPixel;GLint width;GLint height;GLuint texID;GLint size;GLuint type;} Texture;#endif  //TEXTURE_H#ifndef TARGA_H#define TARGA_H#include <GL/gl.h>#include <fstream>#include "texture.h"class LoadTexture{public:LoadTexture(){}~LoadTexture(){}typedef struct{GLbyte idLength;GLbyte colourMapType;GLbyte imageType;//Color Map Specification:GLbyte firstEntryIndex[2];GLbyte colorMapLength[2];GLbyte colorMapEntrySize;//image specificationGLbyte xOrigin[2];GLbyte yOrigin[2];GLbyte imageWidth[2];GLbyte imageHeight[2];GLbyte pixelDepth;GLbyte imageDescriptor;} TGAHeader;TGAHeader tgaHeader;bool LoadTGATexture( char *, Texture * );bool LoadUncompressedTexture( TGAHeader *, Texture *, std::fstream * );bool LoadCompressedTexture( TGAHeader *, Texture *, std::fstream * );};#endif  //TARGA_H#include "targa.h"#include <cstdlib>bool LoadTexture::LoadTGATexture( char *fileName, Texture *texture ){std::fstream file;//Open the texture file to be readfile.open( fileName, std::ios::in | std::ios::binary );//Read in the file in binary modeif ( !file ){//If we failed to read the fileprintf( "Error : Could not open file %s\n", fileName );file.close();return false;}else{//We opened the file succesfullyprintf( "Opened file %s succesfully\n", fileName );}//file.seekg( 0, std::ios::beg );//Make sure the pointer points to the beginning of the file - paranoid - probably redundantif( !( file.read( ( char * )&tgaHeader, sizeof( tgaHeader ) ) ) ){//If we couldnt read in the header of the Targa image ( 18 bytes BTW )printf( "Error : failed to read file header" );file.close();return false;}if( ( tgaHeader.imageType == 2) ){//If it is an uncompressed Targa imageif( !( LoadUncompressedTexture( &tgaHeader, texture, &file ) ) ){//If the function failed to load the uncompressed Targa imageprintf( "Error loading texture, aborting" );return false;}}else if( ( tgaHeader.imageType == 10 ) ){//If it is a compressed Targa imageif( !( LoadCompressedTexture( &tgaHeader, texture, &file ) ) ){//If the function failed to load the compressed Targa imageprintf( "Error loading texture, aborting" );return false;}}else{//If the file is neither a compressed nor uncompressed Targa imageprintf( "File is not a compressed or uncompressed targa image, aborting\n" );file.close();return false;}/* Setting up the texture and binding it for OpenGL */glGenTextures( 1, &texture[0].texID );glBindTexture( GL_TEXTURE_2D, texture[0].texID );glTexImage2D( GL_TEXTURE_2D, 0, 3, texture[0].width, texture[0].height, 0, GL_RGB, GL_UNSIGNED_BYTE,texture[0].imageData );glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR );glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR );file.close();//Close the file since we''re done with itdelete texture->imageData;//delete the allocate space for the Targa image data since we''re finished with itreturn true;}bool LoadTexture::LoadUncompressedTexture( TGAHeader *tgaHeader, Texture *texture, std::fstream * file ){GLuint swap;//Variable used later on to swap the byte order from RGB to BGR for OpenGLprintf( "Loading uncompressed tga image\n" );/* This next block fills the Texture we are generating with pertinent information from the header we read from the Targa image */texture->idLength = tgaHeader->idLength;texture->colorMapLength = tgaHeader->firstEntryIndex[0] + tgaHeader->firstEntryIndex[1] + tgaHeader->colorMapEntrySize;texture->width = abs( tgaHeader->imageWidth[1] * 256 ) +  abs( tgaHeader->imageWidth[0] );texture->height = abs( tgaHeader->imageHeight[1] * 256 ) +  abs( tgaHeader->imageHeight[0] );texture->bytesPerPixel = tgaHeader->pixelDepth/8;if ( tgaHeader->pixelDepth == 24 ){//If we have a 24 bpp Targa imagetexture->type = GL_RGB;//Set the type for OpenGL}else if ( tgaHeader->pixelDepth == 32 ){//If we have a 32 bpp Targa imagetexture->type = GL_RGBA;//Set the type for OpenGL} else{//If the Targa image has a different bppprintf ( "Error : Bit depth must equal 24 or 32, aborting" );return false;}/* This next block calculates, allocates and finally reads in the actual image data from the Targa image and then swaps the byte order */texture->size = texture->bytesPerPixel * texture->width * texture->height;texture->imageData = new GLubyte[texture->size];file->seekg( ( sizeof( texture->idLength ) + sizeof( texture->colorMapLength ) ), std::ios::cur );//Jump to the byte offset where the actual image data beginsfile->read( ( char * )texture->imageData, sizeof( texture->imageData ) );for(swap = 0; swap < ( int )texture->size; swap += ( texture->bytesPerPixel ) ){texture->imageData[swap] ^= texture->imageData[swap+2] ^=texture->imageData[swap] ^= texture->imageData[swap+2];}//delete texture->imageData;return true;}bool LoadTexture::LoadCompressedTexture( TGAHeader *tgaHeader, Texture *texture, std::fstream * file ){printf( "Loading compressed tga image\n" );texture->width = ( abs( tgaHeader->imageWidth[1] * 256 ) +  abs( tgaHeader->imageWidth[0] ) );texture->height = ( abs( tgaHeader->imageHeight[1] * 256 ) +  abs( tgaHeader->imageHeight[0] ) );texture->bytesPerPixel = tgaHeader->pixelDepth;if ( texture->bytesPerPixel == 24 ){texture->type = GL_RGB;}else if ( texture->bytesPerPixel == 32 ){texture->type = GL_RGBA;} else{printf ( "Error : Bit depth must equal 24 or 32, aborting" );return false;}return true;}#include "seraphgl.h"#include "targa.h"#include "texture.h"LoadTexture loadTexture;Texture texture[1];void SeraphGL::LoadGLTextures(){}void SeraphGL::DrawBox( GLuint &boxList ){boxList = glGenLists( 1 );glNewList( boxList, GL_COMPILE );glBegin( GL_QUADS );//Front FaceglTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);// Back FaceglTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);// Top FaceglTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  1.0f);glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  1.0f);glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);// Bottom FaceglTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);// Right faceglTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);// Left FaceglTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);glEnd();glEndList();}void SeraphGL::initializeGL(){glShadeModel( GL_SMOOTH );qglClearColor( black );glClearDepth( 1.0f );glEnable( GL_TEXTURE_2D );glEnable( GL_DEPTH_TEST );glEnable( GL_POLYGON_SMOOTH );glDepthFunc(GL_LEQUAL);glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );glTranslatef( 0.0, 0.0, 0.0 );if( !( loadTexture.LoadTGATexture( "../data/texture.tga", &texture[0] ) ) ){printf( "Error initialising LoadTGATexture\n" );} elseprintf( "Succesfully initialized LoadTGATexture\n" );DrawBox( boxList );}void SeraphGL::resizeGL( GLsizei width, GLsizei height ){glViewport( 0, 0, width, height );glMatrixMode( GL_PROJECTION );glLoadIdentity();gluPerspective( 90.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);glMatrixMode( GL_MODELVIEW );glLoadIdentity();}void SeraphGL::paintGL(){glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );glLoadIdentity();glTranslatef( 0.0f, 0.0f, -5.0f );glRotatef( xRotation, 1.0, 0.0, 0.0 );glRotatef( yRotation, 0.0, 1.0, 0.0 );glRotatef( zRotation, 0.0, 0.0, 1.0 );glBindTexture(GL_TEXTURE_2D, texture[0].texID);glCallList( boxList );}void SeraphGL::setXRotation( int xRot ){xRotation = (GLint)( xRot % 360 );updateGL();}void SeraphGL::setYRotation( int yRot ){yRotation = (GLint)( yRot % 360 );updateGL();}void SeraphGL::setZRotation( int zRot ){zRotation = (GLint)( zRot % 360 );updateGL();}Any idea why?  I appear just to have a black scren now :/ 
  Actually, from what I can tell the texture is actually binding - I think what is happening is something else.  Either the scene needs to be lit (although from the countless tutorials I examined, they don''t light the scene) or my algorithm for sorting the bits into BGR is screwy, which I doubt since I pasted it  