graphics problem

Hi I have a program with a cabin that does not look how it should. The triangles on the side of the roof are being chopped off for some reason. Here is a screen shot. http://free.hostdepartment.com/P/ProgrammingHQ/problem.JPG

I didn’t have this problem until I started to swap from ortho to perspective for a health bar.

any ideas?

Well. It seems that the problem refers to the new and far planes of the function gluPerspective().
USe from the following function as an example:
gluPerspective( 54.0f, (GLfloat)width/(GLfloat)height, 0.1, 1000 );

Maybe the far plane in your program has been set to a small value.
-Ehsan-

No, my far value is set at 50 and my near value at 0.1. My entire area is only 10X10. It didn’t have this effect until I started using the ortho view.

hmm is this thread new? the screenie looks like from 1992 - anyway might be a z-fighting problem

also why using ortho view?

Originally posted by Terminatore3:

I didn’t have this problem until I started to swap from ortho to perspective for a health bar.

Now i understand…
1.Draw your home with the perspective view. Draw your health bar with the orthographic view.
2.When you want to change the definitions of the projection matrix, you should use from the function glLoadIdentity().

So you can use from the following code:
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective();

glMatrixMode( GL_MODELVIEW );
glLoadIdentity(); //optional
<Do your transformations and draw your home, your trees>
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho();

glMatrixMode( GL_MODELVIEW );
glLoadIdentity(); //optional
<Do your transformations and draw the health bar>

-Ehsan-

hmm is this thread new? the screenie looks like from 1992
No I took that screen shot today.

Anyways, Ehsan Kamrani, I think I am doing it right here is my code.

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(60, 1000/700, 0.001, 50);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(view.x,view.y, view.z, view.lx, view.ly, view.lz, 0, 0, 1); 
<draw scene>

glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(-5,5,-5,5);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
<draw health>

OK. it seems that your problem refers to the znear plane in the function gluPerspective(). 0.001 is too small and is near to 0. never set the znear plane to very small values. 0.1 is suitable.
hope this helps.
-Ehsan-

great thanks!

You’re welcome!I’m so happy that could help you.
-Ehsan-