Jump to content
  • Advertisement
Sign in to follow this  
JD557

OpenGL Problem with Evaluators (and possibly display lists)

This topic is 2628 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there.
I have a class to draw a room in openGL, using evaluators for the floor (that's part of the assignment).
In my class constructor, I build the evaluator:


vertices[0][0]=-roomX;vertices[0][1]=0;vertices[0][2]=-roomZ;
vertices[1][0]=roomX+AMP_P_CURVA;vertices[1][1]=0;vertices[1][2]=-roomZ;
vertices[2][0]=-roomX;vertices[2][1]=0;vertices[2][2]=roomZ;
vertices[3][0]=roomX+AMP_P_CURVA;vertices[3][1]=0;vertices[3][2]=roomZ;

normais[0][0]=0;normais[0][1]=1;normais[0][2]=0;
normais[1][0]=0;normais[1][1]=1;normais[1][2]=0;
normais[2][0]=0;normais[2][1]=1;normais[2][2]=0;

uvw[0][0]=0;uvw[0][1]=REPEAT_FLOOR_TEXTURE;
uvw[1][0]=REPEAT_FLOOR_TEXTURE;uvw[1][1]=REPEAT_FLOOR_TEXTURE;
uvw[2][0]=0;uvw[2][1]=0;
uvw[3][0]=REPEAT_FLOOR_TEXTURE;uvw[3][1]=0;

glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_MAP2_NORMAL);
glEnable(GL_MAP2_TEXTURE_COORD_2);
glMap2f(GL_MAP2_VERTEX_3,0.0,1.0,3,2,0.0,1.0,6,2,&vertices[0][0]);
glMap2f(GL_MAP2_NORMAL,0.0,1.0,3,2,0.0,1.0,6,2,&normais[0][0]);
glMap2f(GL_MAP2_TEXTURE_COORD_2,0.0,1.0,2,2,0.0,1.0,4,2,&uvw[0][0]);



and when i generate my display list, I render it:



glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_MAP2_NORMAL);
glEnable(GL_MAP2_TEXTURE_COORD_2);
glMap2f(GL_MAP2_VERTEX_3,0.0,1.0,3,2,0.0,1.0,6,2,&vertices[0][0]);
glMap2f(GL_MAP2_NORMAL,0.0,1.0,3,2,0.0,1.0,6,2,&normais[0][0]);
glMap2f(GL_MAP2_TEXTURE_COORD_2,0.0,1.0,2,2,0.0,1.0,4,2,&uvw[0][0]);

// Chao
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_chao_shininess);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_chao_specular);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_chao_diffuse);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_chao_ambient);


glBindTexture(GL_TEXTURE_2D,texture_floor);
glMapGrid2f(SLICES_FLOOR_U,0.0,1.0,SLICES_FLOOR_V,0.0,1.0);
glEvalMesh2(GL_FILL,0,SLICES_FLOOR_U,0,SLICES_FLOOR_V);



My problem is that, as you can see, I'm generating the evaluator again in the display list. If I don't do that it won't render my evaluator.
I tried moving the code from the constructor and put it right before the glNewList() and it won't work (if I put it immediately after, it starts working).
I also tried put the glEvalMesh2 outside the displayList. Still doesn't work.
Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!