Hi
i posted a question about drawing an egg, i got that part working now i am stuck with the texture mapping part.
this is the code i am trying to initialize the texture coordinate.
for(int longVertCount=0; longVertCount<NUM_LONGITUDINAL_VERTICES; longVertCount++){ // along z axis
for(int circumVertCount=0; circumVertCount<NUM_CIRCUMFERENTIALL_VERTICES; circumVertCount++){ // x and y
a = (float)longVertCount/(float) (NUM_LONGITUDINAL_VERTICES);
b = (float)circumVertCount / (float)(NUM_CIRCUMFERENTIALL_VERTICES);
texture_coordinates[longVertCount][circumVertCount][1] = a*basketRadius;
texture_coordinates[longVertCount][circumVertCount][0] = b*basketHeight;
}
}
and this is the code for drawing the texture
for(int longVertCount=0; longVertCount<NUM_LONGITUDINAL_VERTICES-1; longVertCount++){ // along z axis
glBegin(GL_QUAD_STRIP);
for(int circumVertCount=0; circumVertCount<NUM_CIRCUMFERENTIALL_VERTICES; circumVertCount++){
glTexCoord2fv(texture_coordinates[longVertCount][circumVertCount]);
glVertex3fv(vertices[longVertCount][circumVertCount]);
glTexCoord2fv(texture_coordinates[longVertCount+1][circumVertCount]);
glVertex3fv(vertices[longVertCount+1][circumVertCount]);
}
glEnd();
}
but my texture mapping is wrong. any help??