First off, great tuts'.. I've learned a fair bit, cruising this board, and d/ling the tuts.
But I've run into a snag. that is. quite frustrating.
I though I'd get clever by converting the single file lesson23 into a multi-file project... No problems there...(which suprised me)
I'm slowly moving the core OpenGL stuff into classes, to modulise the whole thing, for my project.. again no errors with doing that, Compiler or linker (yay).
But when it comes to execute the code, I get the fullscreen/yes-no box (which is correct) then it drops back out to desktop.
I've put in some break points and ran debugger. and it fails to load the texture files..
int RunnerGraphics::LoadGLTextures(void) // Load Bitmaps And Convert To Textures
{
int Status=false; // Status Indicator
AUX_RGBImageRec *TextureImage[5]; // Create Storage Space For The Textures
memset(TextureImage,0,sizeof(void *)*5); // Set The Pointer To NULL
if ((TextureImage[0]=LoadBMP("Data/floor1.bmp")) && // Load The Floor Texture
(TextureImage[1]=LoadBMP("Data/light1.bmp")) && // Load the Light Texture
(TextureImage[2]=LoadBMP("Data/rustyblue.bmp")) && // Load the Wall Texture
(TextureImage[3]=LoadBMP("Data/crate.bmp")) && // Load the Crate Texture
(TextureImage[4]=LoadBMP("Data/weirdbrick.bmp"))) // Load the Ceiling Texture
{
Status=true; // Set The Status To true
glGenTextures(5, &texture[0]); // Create The Texture
for (int loop1=0; loop1<5; loop1++) // Loop Through 5 Textures
{
glBindTexture(GL_TEXTURE_2D, texture[loop1]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[loop1]->sizeX, TextureImage[loop1]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[loop1]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
for (loop1=0; loop1<5; loop1++) // Loop Through 5 Textures
{
if (TextureImage[loop1]) // If Texture Exists
{
if (TextureImage[loop1]->data) // If Texture Image Exists
{
free(TextureImage[loop1]->data); // Free The Texture Image Memory
}
free(TextureImage[loop1]); // Free The Image Structure
}
}
}
return Status; // Return The Status
}
AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image
{
FILE *File=NULL; // File Handle
if (!Filename) // Make Sure A Filename Was Given
{
return NULL; // If Not Return NULL
}
File=fopen(Filename,"r"); // Check To See If The File Exists
/* ******GRRRRR fails here**** */ if (File) // Does The File Exist?
{
fclose(File); // Close The Handle
return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer
}
LogWrite("Hello silly me .. ErrorLoading file :%s ,Stream %d",Filename, File);
return NULL; // If Load Failed Return NULL
}
when I trace through, it fails on the "if(File)" section above. which in turn causes the first IF in the first function fail.
I've checked the files for typos, check for correct directory location, even checked to see in I had rights to access them.
I even tried changing the "if(File)" to " if(!File)" just to see where the code ends up.. it broke, another call later on didn't like being supplied NULL textures or something..which didn't surprise me..
Has anyone else come across this type of error, playing around with lesson23 (which isn't on nehe anymore

Using vc71....and XP, modifed code to work with Directinput8.
/me pulls out more hair.....Arggghhhh
[edited by - WhytWulf on July 16, 2003 7:37:43 PM]