OpenGL: texture evaluators (urgent!)
Hi, please help I'm in a hurry
Code:
void SurfaceMesh::pack(){
GLfloat texturecoords[4][2];
/*...................*/
glNewList(getListID(),GL_COMPILE);
for(int n_pts = points.size();n_pts>2;n_pts-=2){
/*...............*/
glMap2f(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 2, 0.0, 1.0, 6, 2, &ctrlpoints[0][0]);
glMap2f(GL_MAP2_NORMAL, 0.0, 1.0, 3, 2, 0.0, 1.0, 6, 2, &nrmlcompon[0][0]);
if(_texture){
glBindTexture(GL_TEXTURE_2D, _texture->getTextID());
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0.0, 1.0, 4, 2, 0.0 , 1.0, 2, 2, &texturecoords[0][0]);
}else
glMap2f(GL_MAP2_COLOR_4, 0.0, 1.0, 4, 2, 0.0, 1.0, 8, 2, &colrpoints[0][0]);
glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_MAP2_NORMAL);
glEnable(GL_MAP2_COLOR_4);
glEnable(GL_MAP2_TEXTURE_COORD_2);
int evx, evz;
/*................*/
glMapGrid2f(evx, 0.0,1.0, evz, 0.0,1.0);
glEvalMesh2(GL_FILL, 0,evx, 0,evz);
}
glEndList();
packed = true;
}
I have a class SurfaceMesh for managing a surface, you can see an excert of the pack function which calculates normals, extra geometry, evaluators and places it in a glList.
Everything in the code is working fine, except for one detail.
the glMap2f(...) function. How can I bind the evaluator to a specific texture?? That is, I have a Texture class that loads a texture file to memory, and gets a valid number to identify it self. Then When I call Map, a certain texture with certain id number must be bound to that glMap function calling. But it seems not to be working
Thanks in advance!
glMap2{fd}(GLenum target, TYPEu1, TYPEu2, GLint ustride, GLint uorder, TYPEv1, TYPEv2, GLint vstride, GLint vorder, TYPE points);