OPENGL坐标变换的问题
我的代码如下:
void CWnd3D::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
HDC hdc = ::GetDC(m_hWnd);
HGLRC hglrc;
// TODO: Add your message handler code here
glClearColor(0,0,0,0);
glColor3f(1, 1, 1);
if (hglrc = wglCreateContext(hdc))
{
// try to make it the thread's current rendering context
if(wglMakeCurrent(hdc, hglrc))
{
//render here
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(m_fRot[0], 1, 0, 0);
glRotatef(m_fRot[1], 0, 1, 0);
glScalef(200, 300, 256);/////注意这行!!
//画坐标轴
if (m_bAxis)
{
DrawAxis();
}
glPopMatrix();
// glFlush();
SwapBuffers(hdc);
}
}
wglMakeCurrent(NULL, NULL) ;
::ReleaseDC (m_hWnd, hdc) ;
wglDeleteContext(hglrc);
// Do not call CWnd::OnPaint() for painting messages
}
void CWnd3D::DrawAxis()
{
glBegin(GL_LINES);
glColor3f(1,0,0);//x轴
glVertex3f(0,0,0);
glVertex3f(1,0,0);
glColor3f(0,1,0);//y轴
glVertex3f(0,0,0);
glVertex3f(0,1,0);
glColor3f(0,0,1);//z轴
glVertex3f(0,0,0);
glVertex3f(0,0,1);
glEnd();
}
我想画坐标超过100的图元(如画线从(0,0,0)到(200,120,200)),怎么办?用glScalef()怎么没有反应???