ive being trying unsuccessfully to keep a record of which bitmap is texture mapped to the different objects. The polygon draws fine but without the texture. what am i doing wrong. sorry to bother you again. this is definately the last time.i set up the object something like this and the main code is also below.
typedef struct {
GLfloat x1,y1,x2,y2,x3,y3,x4,y4,z; /* Vertices of polygon */
COGLTexture texture;//texture record
}object_type;
COGLTexture car,car1,car2;
void init_world(world_data ot)
{
/ object 1 - */
ot->object[0].texture = car;
ot->object[0].x1 = 0.0;
ot->object[0].y1 = 0.0;
ot->object[0].x2 = 0.0;
ot->object[0].y2 = 0.2;
ot->object[0].x3 = 0.2;
ot->object[0].y3 = 0.2;
ot->object[0].x4 = 0.2;
ot->object[0].y4 = 0.0;
ot->object[0].z = 0.0;
}
For each object i then call a draw method
void drawPolygon (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3,GLfloat x4, GLfloat y4, GLfloat z, COGLTexture texture)
{
car.LoadFromFile(“tools/car.bmp”);
glEnable(GL_TEXTURE_2D);
texture.SetActive();
glBegin (GL_POLYGON);
glTexCoord2f(1.0,0.0);
glVertex3f (x1, y1, z);
glTexCoord2f(1.0,1.0);
glVertex3f (x2, y2, z);
glTexCoord2f(0.0,1.0);
glVertex3f (x3, y3, z);
glTexCoord2f(0.0,0.0);
glVertex3f (x4, y4, z);
glEnd ();
glDisable(GL_TEXTURE_2D);
}