texturing problem, need help =)

I, im having one problem i dont fully understand and im hoping someone here can help me. Im new to openGL but i have java experience. anyway, heres the problem im getting.

here’s the error message:

1>e:\maze\amaze.cpp(44) : error C2664: ‘auxDIBImageLoadW’ : cannot convert parameter 1 from ‘char *’ to ‘LPCWSTR’
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at “file://e:\maze\myMaze\myMaze\Debug\BuildLog.htm”

i’ve marked the problem area in the sourcefile down here with red text.

This is the sourcefile, amaze.cpp

//#define GLUT_BUILDING_LIB
#include <GL/glut.h>
#include <GL/glaux.h> // Header File For The Glaux Library
#include <cmath>
#include <iostream>

const float piover180 = 0.0174532925f;
float heading=1.0;
float xpos=0.0;
float zpos=0.0;
float ypos=0.5; // Height of person

GLfloat yrot=0.0; // Y Rotation
GLfloat walkbias = 0;
GLfloat walkbiasangle = 0;
GLfloat lookupdown = 0.0f;

GLuint txDoor; // Texture

GLuint textures[255];
char bitmaps[255][255];

GLint world; // maze-world

// Lightsource parameters
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightSpecular[]= { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[]= { 0.5f, 1.0f, 0.0f, 1.0f };

float spin=0.0; // Spinning teapot

GLuint LoadGLTextures(char *file) // Load Bitmaps And Convert To Textures
{
GLuint texture;
AUX_RGBImageRec * TextureImage[1]; // Create Storage Space For The Texture
memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL

    // Load The Bitmap

	[b]if (TextureImage[0] == auxDIBImageLoad(file))[/b]
    {
            glGenTextures(1, &texture);				// Create Texture

			// Create MipMapped Texture
			glBindTexture(GL_TEXTURE_2D, texture);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
			gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]-&gt;sizeX, TextureImage[0]-&gt;sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]-&gt;data);

			if (TextureImage[0]-&gt;data)              // If Texture Image Exists
            {
                    free(TextureImage[0]-&gt;data);    // Free The Texture Image Memory
            }

            free(TextureImage[0]);                  // Free The Image Structure
    }
    return texture;                                 // Return The Texture

}

// Declarations needed for the maze-world
typedef struct tagVERTEX
{
float x, y, z;
float u, v;
} VERTEX;

typedef struct tagTRIANGLE
{
VERTEX vertex[3];
} TRIANGLE;

typedef struct tagSECTOR
{
int numtriangles;
TRIANGLE* triangle;
} SECTOR;

SECTOR sector1; // Our Model Goes Here:

void readstr(FILE *f,char *string) // Read a line from the file with world data
{
do
{
fgets(string, 255, f);
} while ((string[0] == ‘/’) || (string[0] == ’
'));
return;
}

void BuildPolygons() // Display list with the world data
{
glNewList(world, GL_COMPILE);

GLfloat x_m, y_m, z_m, u_m, v_m;
int numtriangles= sector1.numtriangles;

// Process Each Triangle
for (int loop_m = 0; loop_m &lt; numtriangles; loop_m++)
{
	glBindTexture(GL_TEXTURE_2D, textures[loop_m]); // One texture for two triangles
	glBegin(GL_TRIANGLES);
		glNormal3f( 0.0f, 0.0f, 1.0f);
		x_m = sector1.triangle[loop_m].vertex[0].x;
		y_m = sector1.triangle[loop_m].vertex[0].y;
		z_m = sector1.triangle[loop_m].vertex[0].z;
		u_m = sector1.triangle[loop_m].vertex[0].u;
		v_m = sector1.triangle[loop_m].vertex[0].v;
		glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
		
		x_m = sector1.triangle[loop_m].vertex[1].x;
		y_m = sector1.triangle[loop_m].vertex[1].y;
		z_m = sector1.triangle[loop_m].vertex[1].z;
		u_m = sector1.triangle[loop_m].vertex[1].u;
		v_m = sector1.triangle[loop_m].vertex[1].v;
		glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
		
		x_m = sector1.triangle[loop_m].vertex[2].x;
		y_m = sector1.triangle[loop_m].vertex[2].y;
		z_m = sector1.triangle[loop_m].vertex[2].z;
		u_m = sector1.triangle[loop_m].vertex[2].u;
		v_m = sector1.triangle[loop_m].vertex[2].v;
		glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
	glEnd();
	loop_m++;
	glBegin(GL_TRIANGLES);
		glNormal3f( 0.0f, 0.0f, 1.0f);
		x_m = sector1.triangle[loop_m].vertex[0].x;
		y_m = sector1.triangle[loop_m].vertex[0].y;
		z_m = sector1.triangle[loop_m].vertex[0].z;
		u_m = sector1.triangle[loop_m].vertex[0].u;
		v_m = sector1.triangle[loop_m].vertex[0].v;
		glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
		
		x_m = sector1.triangle[loop_m].vertex[1].x;
		y_m = sector1.triangle[loop_m].vertex[1].y;
		z_m = sector1.triangle[loop_m].vertex[1].z;
		u_m = sector1.triangle[loop_m].vertex[1].u;
		v_m = sector1.triangle[loop_m].vertex[1].v;
		glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
		
		x_m = sector1.triangle[loop_m].vertex[2].x;
		y_m = sector1.triangle[loop_m].vertex[2].y;
		z_m = sector1.triangle[loop_m].vertex[2].z;
		u_m = sector1.triangle[loop_m].vertex[2].u;
		v_m = sector1.triangle[loop_m].vertex[2].v;
		glTexCoord2f(u_m,v_m); glVertex3f(x_m,y_m,z_m);
	glEnd();

}
glEndList();

}

void SetupWorld() // create the world
{
float x, y, z, u, v;
int numtriangles;
FILE *filein;
char oneline[255];

filein = fopen("Data/world.txt", "rt");				// File To Load World Data From

readstr(filein,oneline);
sscanf(oneline, "NUMPOLLIES %d

", &numtriangles);

sector1.triangle = new TRIANGLE[numtriangles];
sector1.numtriangles = numtriangles;
for (int loop = 0; loop &lt; numtriangles; loop++)
{
	readstr(filein,oneline);

	sscanf(oneline, "%s ", bitmaps[loop]);
	//std::cout&lt;&lt;bitmaps[loop]&lt;&lt; " - " &lt;&lt;std::endl;

	textures[loop] = LoadGLTextures(bitmaps[loop]); // One texture for two triangles

	for (int vert = 0; vert &lt; 3; vert++)
	{
		readstr(filein,oneline);
	//	std::cout&lt;&lt;oneline&lt;&lt; " * " &lt;&lt;std::endl;

		sscanf(oneline, "%f %f %f %f %f", &x, &y, &z, &u, &v);
		sector1.triangle[loop].vertex[vert].x = x;
		sector1.triangle[loop].vertex[vert].y = y;
		sector1.triangle[loop].vertex[vert].z = z;
		sector1.triangle[loop].vertex[vert].u = u;
		sector1.triangle[loop].vertex[vert].v = v;
	}
	loop++; // Next triangle in patch
	for (int vert = 0; vert &lt; 3; vert++)
	{
		readstr(filein,oneline);
	//	std::cout&lt;&lt;oneline&lt;&lt; " * " &lt;&lt;std::endl;

		sscanf(oneline, "%f %f %f %f %f", &x, &y, &z, &u, &v);
		sector1.triangle[loop].vertex[vert].x = x;
		sector1.triangle[loop].vertex[vert].y = y;
		sector1.triangle[loop].vertex[vert].z = z;
		sector1.triangle[loop].vertex[vert].u = u;
		sector1.triangle[loop].vertex[vert].v = v;
	}
}
fclose(filein);
BuildPolygons();

}

void myIdleFunc() // Spinn the teapot
{
spin+=2.0;
if (spin>360.0) spin=0.0;
glutPostRedisplay();

}

void spinPot(float x, float y, float z) // Move the teapot
{
glPushMatrix();
glTranslatef(x, y, z);
glRotatef(spin+=1.0, 0.0, 1.0, 0.0);
glutSolidTeapot(0.2);
glPopMatrix();
}

void display(void) // Draw everything
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View

GLfloat xtrans = -xpos;
GLfloat ztrans = -zpos;
GLfloat ytrans = -walkbias-ypos;
GLfloat sceneroty = 360.0f - yrot;

glRotatef(lookupdown,1.0f,0,0);
glRotatef(sceneroty,0,1.0f,0);
glTranslatef(xtrans, ytrans, ztrans);

// Display the world
glCallList(world);

// Draw some doors
glBindTexture(GL_TEXTURE_2D, txDoor); 

glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0); glVertex3f(2.5, 0.0, -0.5);
glTexCoord2f(1.0, 0.0); glVertex3f(2.5, 0.0, 0.5);
glTexCoord2f(0.0, 1.0); glVertex3f(2.5, 1.0, -0.5);
glEnd();
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 1.0); glVertex3f(2.5, 1.0, -0.5);
glTexCoord2f(1.0, 0.0); glVertex3f(2.5, 0.0, 0.5);
glTexCoord2f(1.0, 1.0); glVertex3f(2.5, 1.0, 0.5);
glEnd();

glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0); glVertex3f(-0.5, 0.0, 2.5);
glTexCoord2f(1.0, 0.0); glVertex3f(0.5, 0.0, 2.5);
glTexCoord2f(0.0, 1.0); glVertex3f(-0.5, 1.0, 2.5);
glEnd();
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 1.0); glVertex3f(-0.5, 1.0, 2.5);
glTexCoord2f(1.0, 0.0); glVertex3f(0.5, 0.0, 2.5);
glTexCoord2f(1.0, 1.0); glVertex3f(0.5, 1.0, 2.5);
glEnd();

glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0); glVertex3f(-0.5, 0.0, -2.5);
glTexCoord2f(1.0, 0.0); glVertex3f(0.5, 0.0, -2.5);
glTexCoord2f(0.0, 1.0); glVertex3f(-0.5, 1.0, -2.5);
glEnd();
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 1.0); glVertex3f(-0.5, 1.0, -2.5);
glTexCoord2f(1.0, 0.0); glVertex3f(0.5, 0.0, -2.5);
glTexCoord2f(1.0, 1.0); glVertex3f(0.5, 1.0, -2.5);
glEnd();

// Draw a rotating teapot and lit it up!
glDisable(GL_TEXTURE_2D);							// Disable Texture Mapping
glEnable (GL_LIGHTING);								// Enables Lighting
spinPot(1.5,0.5,1.0);
glEnable(GL_TEXTURE_2D);							// Enable Texture Mapping
glDisable (GL_LIGHTING);							// Disables Lighting

// Display it!
glFlush();
glutSwapBuffers();

}
void keys(int key, int x, int y) // Interaction
{
switch(key)
{
case GLUT_KEY_UP:
{
xpos -= (float)sin(headingpiover180) * 0.05f;
zpos -= (float)cos(heading
piover180) * 0.05f;
if (walkbiasangle >= 359.0f)
{
walkbiasangle = 0.0f;
}
else
{
walkbiasangle+= 20.0;
}
walkbias = (float)sin(walkbiasangle * piover180)/30.0f;
} break;

	case GLUT_KEY_DOWN:
	{
		xpos += (float)sin(heading*piover180) * 0.05f;
		zpos += (float)cos(heading*piover180) * 0.05f;
		if (walkbiasangle &lt;= 1.0f)
		{
			walkbiasangle = 359.0f;
		}
		else
		{
			walkbiasangle-= 20.0;
		}
		walkbias = (float)sin(walkbiasangle * piover180)/30.0f;
	} break;

	case GLUT_KEY_RIGHT:
	{
		heading -= 1.0f;
		yrot = heading;
	} break;

	case GLUT_KEY_LEFT:
	{
		heading += 1.0f;	
		yrot = heading;
	} break;

	case GLUT_KEY_PAGE_UP:
	{
		lookupdown-= 1.0f;
	} break;

	case GLUT_KEY_PAGE_DOWN:
	{
		lookupdown+= 1.0f;
	} break;
}
glutPostRedisplay();

}

void myReshape(int width, int height) {

glViewport(0,0,width,height);						// Reset The Current Viewport

glMatrixMode(GL_PROJECTION);						// Select The Projection Matrix
glLoadIdentity();									// Reset The Projection Matrix

// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

glMatrixMode(GL_MODELVIEW);							// Select The Modelview Matrix
glLoadIdentity();									// Reset The Modelview Matrix

}

int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(500, 500);
glutCreateWindow(“Amaze”);

world = glGenLists(1);
SetupWorld();

// Event functions
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutIdleFunc(myIdleFunc);
glutSpecialFunc(keys);

// Init
glEnable(GL_TEXTURE_2D);							// Enable Texture Mapping
glBlendFunc(GL_SRC_ALPHA,GL_ONE);					// Set The Blending Function For Translucency
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);				// This Will Clear The Background Color To Black
glClearDepth(1.0);									// Enables Clearing Of The Depth Buffer
glDepthFunc(GL_LESS);								// The Type Of Depth Test To Do
glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
glShadeModel(GL_SMOOTH);							// Enables Smooth Color Shading
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations

txDoor = LoadGLTextures("Data/door.bmp");			// Load textures for doors

// Lighting
glLightfv(GL_LIGHT0, GL_AMBIENT,  LightAmbient);	// Setup The Ambient Light
glLightfv(GL_LIGHT0, GL_DIFFUSE,  LightDiffuse);	// Setup The Diffuse Light
glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular);	// Setup The Specular Light
glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);	// Position The Light
glEnable(GL_LIGHT0);								// Enable Light One

// Let's go!
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glutMainLoop();
return 0;

}

if someone could help me i would really appreciate it.

First of all, you probably meant to write:

if (TextureImage[0] = auxDIBImageLoad(file))

instead of

if (TextureImage[0] == auxDIBImageLoad(file))

Secondly, the char* and LPCWSTR types are incompatible. LPCWSTR uses wide chars so you will need to convert it. Here’s your answer.

N.

ok thanks. ill look in to it

I think you are using Visual Studio 2005 or 2008.
In that case, edit your project properties, go to General->Character Set and change from “Use Unicode Character Set” to “Use Multi-Byte Character Set”.