Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I drawed a house, many pillars(auxsolidbox, height is 0 to 18.6meter), and two floors(auxsolidbox, height is 6.55m, 12.6m). It's okay in glOrtho view, and I can change the camera's position using KEY_DOWN.
I am puzzled with one thing : when I look down at the Ortho space(-37,37,-20,20, 1,500) at the (0,8.5,0)position, I can't see the pillars. I thought the pillars are hide by the floor. If I change the Ortho space(-37,37,-20,20, -500,500), the pillars appears. and If I change the Ortho space(-37,37,-20,20,1,4) at the (0,5.5,0), pillars gone again.
Help me please, I am so puzzled.:-(

I thought the Ortho space would cut the objects whose part in the space, and ignore the objects outside the space. But it seems that is wrong. and I don't know why.

here are some code:


glViewport(0, 0, (GLsizei) cx, (GLsizei) cy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(m_Width<=m_Height)
glOrtho(-nRange,nRange,-nRange*m_Height/m_Width,nRange*m_Height/m_Width,fnear,ffar);
else
glOrtho(-nRange*m_Width/m_Height,nRange*m_Width/m_Height,-nRange,nRange,fnear,ffar);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(m_Camera.ex, m_Camera.ey, m_Camera.ez, m_Camera.cx, m_Camera.cy, m_Camera.cz,
m_Camera.ux, m_Camera.uy, m_Camera.uz);
DrawPillarandfloor();
Posted
Updated 29-Oct-14 22:52pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900