Hi, having trouble getting this to work with a .raw file...
When the texture is mapped it displays the image all in black.![]()
Can someone please give me a hint as to what im doing wrong?
This is the image reading function:
Any help would be great, thanks.Code://some previous declarations: //typedef GLubyte pixel; //pixel image[MAXROW][MAXCOL][3]; //int charin; //int r,c; //ifstream in; void InputImage(void) { printf("Enter the name of the input file: "); gets(inf_name); in.open(inf_name,ios::binary); if(in.fail()) /* open failed */ { puts("*** Can't open input file - please check file name typed!\n "); charin = getchar(); exit(1); } for ( r = 0; r < MAXROW; r++ ) for ( c = 0; c < MAXCOL; c++) { if(in.eof()) { printf("*** End of file reached!\n "); in.close(); /* close input file */ charin = getchar(); exit(1); } else { in >> charin; image[r][c][0] = image[r][c][1] = image[r][c][2] = charin; } } in.close(); /* close input file */ printf("\nImage input completed!\n"); } /* end InputImage */



LinkBack URL
About LinkBacks



