I’m having trouble loading in a texture in .raw so I can paste it an object. I changedd this line of the tut so I could load my own image:
load_texture ( “C:\Documents and Settings\User\My Documents\My Pictures\aaliyah.raw”, 640, 320, 3, GL_RGB, GL_LINEAR );
but I get the following errors:
23 C:\Program Files\c++\Dev-Cpp\ben-prog exturesphere.cpp:60
[Warning] unknown escape sequence ‘\D’
23 C:\Program Files\c++\Dev-Cpp\ben-prog exturesphere.cpp:60
non-hex digit ‘s’ in universal-character-name
23 C:\Program Files\c++\Dev-Cpp\ben-prog exturesphere.cpp:60
[Warning] unknown escape sequence ‘\M’
Anyone know what’s wrong?
void load_texture ( char *file_name, int width, int height, int depth, GLenum colour_type, GLenum filter_type )
{
GLubyte *raw_bitmap ;
FILE *file;
if ((file = fopen(file_name, “rb”))==NULL)
{
printf("File Not Found : %s
",file_name);
system(“pause”);
exit (1);
}
raw_bitmap = (GLubyte *) malloc ( width * height * depth * ( sizeof ( GLubyte )) );
if ( raw_bitmap == NULL )
{
printf ( "Cannot allocate memory for texture
" );
system(“pause”);
fclose ( file );
exit ( 1 );
}
fread ( raw_bitmap , width * height * depth, 1 , file );
fclose ( file);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter_type );
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter_type );
glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
gluBuild2DMipmaps ( GL_TEXTURE_2D, colour_type, width, height, colour_type, GL_UNSIGNED_BYTE, raw_bitmap );
free ( raw_bitmap );
}
void init(void)
{
glShadeModel(GL_FLAT);
glEnable ( GL_DEPTH_TEST );
glEnable ( GL_LIGHTING );
glLightModelfv ( GL_LIGHT_MODEL_AMBIENT, ambient_light );
glLightfv ( GL_LIGHT0, GL_DIFFUSE, source_light );
glLightfv ( GL_LIGHT0, GL_POSITION, light_pos );
glEnable ( GL_LIGHT0 );
glEnable ( GL_COLOR_MATERIAL );
glColorMaterial ( GL_FRONT, GL_AMBIENT_AND_DIFFUSE );
glEnable ( GL_TEXTURE_2D );
glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
load_texture ( "C:\Documents and Settings\User\My Documents\My Pictures\aaliyah.raw", 640, 320, 3, GL_RGB, GL_LINEAR );
glEnable ( GL_CULL_FACE );
glClearColor ( 0.0, 0.0, 0.0, 0.0 );