Thread: OpenGL: texture evaluators (urgent!)

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    722

    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);
    Last edited by xErath; 10-10-2004 at 11:08 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Texture Binding with OpenGL
    By scwizzo in forum Game Programming
    Replies: 5
    Last Post: 07-01-2008, 11:02 AM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM