why the tree can't be displayed

when I create a empty project only displaying tree, the tree can be displayed, but when I put these code into another project with terrain, the tree can not be displayed, I wonder why?
struct plantmodelstruct
{ GLuint masktexture;
GLuint texture;
float sizex;
float sizey;
plantmodelstruct plantmodel;
int nPlantList;

void LoadTextu(char *file, GLuint *ptexture)
AUX_RGBImageRec *TextureImage[1];
memset(TextureImage, 0, sizeof(void *));
TextureImage[0] = auxDIBImageLoad(file);

glBindTexture(GL_TEXTURE_2D, *ptexture);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);



void CDrawCulvertView::LoadPlants()
plantmodel.sizex = 64;
plantmodel.sizey = 128;
glGenTextures(1, &plantmodel.masktexture);
glGenTextures(1, &plantmodel.texture);
LoadTextu(“texture\pflmask.bmp”, &plantmodel.masktexture);
LoadTextu(“texture\pfl.bmp”, &plantmodel.texture);

void DrawPlants()
nPlantList = ModelPlant();

int ModelPlant()
int nModel,j;
nModel = glGenLists(1);
glColor3f(1, 1, 1);

for(j=0; j<4; j++)
{	//mask
	if(j%2 == 0) 
		glBindTexture(GL_TEXTURE_2D, plantmodel.masktexture);
		glBlendFunc(GL_DST_COLOR, GL_ZERO);
		glBindTexture(GL_TEXTURE_2D, plantmodel.texture);
		glBlendFunc(GL_ONE, GL_ONE);
		glRotatef(-90, 0, 1, 0);		
	glTexCoord2f(0, 1); glVertex3f(-plantmodel.sizex, plantmodel.sizey, 0);
	glTexCoord2f(1, 1); glVertex3f(plantmodel.sizex, plantmodel.sizey, 0);
	glTexCoord2f(1, 0); glVertex3f(plantmodel.sizex, 0, 0);
	glTexCoord2f(0, 0); glVertex3f(-plantmodel.sizex, 0, 0);
return nModel;


Please delete this post, since no one help me, I want to post it on the advanced forum

A little patience can be a good thing, sometimes. You post this the evening of the 22, and are upset that you haven’t gotten an answer by the early morning of the next day? (At least for those of us in my half of the world.)

Anyway, I see you are using a display list. And you appear to be creating the display list every time you display the tree. Usually you would only create the list upon startup.

Now, since you are using a display list and you say if you add it to code that displays a terrain, it doesn’t show up. There are numerous reasons this might be, and your code doesn’t show any of them because you’re not showing it within the other project.

  1. You could potentially be over-writing the display list with a display list for the terrain.

  2. Your tree might be getting clipped by the viewing volume.

  3. Your tree might be getting rejected by depth testing if your terrain is in front of the tree.

the reason why I don’t put those codes is they are too long
since I have used

the tree still can be rejected by depth testing?
after I draw the tree, I got a black screen, so I wonder the reason might be gluLookAt(),but I still havn’t solved?

If you got a black screen, you probably are drawing everything outside of the viewing volume. Show how you setup your PROJECTION and MODELVIEW matrices.

It is very strange, the black screen is only to those rendering with glColor3f() parts, that means the material rendering parts, not to the texture mapped parts, e.g, I use multi-texture to terrain, the terrain can be seen, I use glColor3f() to road on the terrain, when the tree begin to draw,the road then become black screen. I don’t know what is the reason?

What are the relative sizes of your tree and terrain? Maybe your tree is huge in relation and you are seeing the back-side of some of the faces covering the screen.

Without seeing more code, there’s not much more I can do to help. If you want, you can e-mail me your project and I’ll take a look at it for you. My e-mail is in my profile.