aus79er
05-15-2002, 10:37 AM
Hi,
I have a simple draw line code ....
I am drawing a line in VC++ MFC application.
void CSim_4_26_02View::draw3dobject()
{
glBegin ( GL_LINES);
glColor3f ( 0.0f, 1.0f, 1.0f ) ;
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(12.5f,0.0f,0.0f);
glEnd();
}
Now I am able to see the line.But the line is going out of the screen.
So what I want to do is to scale the screen so that I can see the whole line falling within the screen.
So what I thought that by translating in Z direction I will be able to see the whole line....
void CSim_4_26_02View::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CView::OnLButtonDblClk(nFlags, point);
glTranslatef(-0.0f,0.0f,+0.9f);
draw3dobject();
}
Now whenever I click on the screen the line diappears...
It works when i translate only in x direction or y...
I have also tried changing the Z value of the translate function from + to - but to no avail....
So when i translate my line in z direction regardless of direction it disappears..
Can any body help me with it...what am i doing wrong....
Thanks in advance
aus
I have a simple draw line code ....
I am drawing a line in VC++ MFC application.
void CSim_4_26_02View::draw3dobject()
{
glBegin ( GL_LINES);
glColor3f ( 0.0f, 1.0f, 1.0f ) ;
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(12.5f,0.0f,0.0f);
glEnd();
}
Now I am able to see the line.But the line is going out of the screen.
So what I want to do is to scale the screen so that I can see the whole line falling within the screen.
So what I thought that by translating in Z direction I will be able to see the whole line....
void CSim_4_26_02View::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CView::OnLButtonDblClk(nFlags, point);
glTranslatef(-0.0f,0.0f,+0.9f);
draw3dobject();
}
Now whenever I click on the screen the line diappears...
It works when i translate only in x direction or y...
I have also tried changing the Z value of the translate function from + to - but to no avail....
So when i translate my line in z direction regardless of direction it disappears..
Can any body help me with it...what am i doing wrong....
Thanks in advance
aus