void set_texture(void){ node_f* temp = Current; int i = 0,j; if ( Current != Before ){ char inputfile[256]; chdir(cd->name); for ( temp = Current; ;temp = temp->next ){ for ( j = 0; temp->name[j] != '\0'; j++ ) inputfile[j] = temp->name[j]; inputfile[j] = '\0'; printf("%s\n",inputfile); printf("%d\n",CheckExtention(inputfile,".jpg")); if( true == CheckExtention(inputfile,".jpg")){ TextureRGBImage Input; Input.ReadImagefromFile(inputfile); glBindTexture(GL_TEXTURE_2D,TextureHandle[i]); glTexSubImage2D(GL_TEXTURE_2D,0, (TEXWIDTH - Input.width)/2, (TEXHEIGHT - Input.height)/2, Input.width, Input.height, GL_RGB, GL_UNSIGNED_BYTE, Input.imageData); i++; } if ( temp->next == NULL )break; } Before = Current; } }
bool ScanParams( int argc, const char * argv[] ) /**********************************************/ { int switchchar; int nofilenames; /* number of filename parms read so far */ bool contok; /* continue with main execution */ int currarg; nofilenames = 0; contok = true; switchchar = _dos_switch_char(); DefaultParms(); for (currarg = 1; currarg < argc && contok; currarg++) { if (*argv[ currarg ] == switchchar || *argv[ currarg ] == '-') { contok = ScanOptionsArg( argv[ currarg ] + 1 ) && contok; } else if (*argv[ currarg ] == '?') { CmdLineParms.PrintHelp = true; contok = false; } else if (nofilenames == 0) { strncpy( CmdLineParms.FileName, argv[ currarg ], _MAX_PATH ); nofilenames++; } else { puts( "Error: Too many arguments on command line" ); contok = false; } } if (contok) { switch (nofilenames) { case 0: puts( "Error: filename required." ); contok = false; break; default: CheckExtention( CmdLineParms.FileName ); break; } } return( contok ); }