Hi experts,
I am loading an image using OpenGL texturing in MDI CView in VC++.I am displaying an image using the Command
glTranslatef(0.0f,0.0f,-250.0f). Now I want to Enlarge the image.so i change the zvalue of the glTranslatef like glTranslatef(0.0f,0.0f,-350.0f).
so, the image enlarged.But, I want to enlarge the image using glScalef().if i give glScalef it didn’t work.
what can i do? any help.
coding is following :
void CLoadMapView::OnPaint()
{
CPaintDC dc(this);
glClearColor(0.0, 0.0, 0.0, 0) ;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ;
glEnable(GL_TEXTURE_2D) ;
glPushMatrix() ;
glTranslatef( 0.0f,0.0f,-250.0f) ;
glBindTexture(GL_TEXTURE_2D, m_textureID);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glBegin(GL_QUADS);
glTexCoord2f(1.0,0.0) ;
glVertex3f((GLdouble)m_width/8 ,(GLdouble)-m_height/8,-0.5) ;
glTexCoord2f(0.0,0.0) ;
glVertex3f((GLdouble)-m_width/8,(GLdouble) -m_height/8,-0.5) ;
glTexCoord2f(0.0,1.0) ;
glVertex3f((GLdouble)-m_width/8,(GLdouble) m_height/8,-0.5) ;
glTexCoord2f(1.0,1.0) ;
glVertex3f((GLdouble)m_width/8, (GLdouble)m_height/8,-0.5) ;
glEnd() ;
glPopMatrix() ;
glDisable(GL_TEXTURE_2D) ;
SwapBuffers(dc) ;
}
void CLoadMapView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy) ;
GLdouble fAspect ;
fAspect = 1.0f ;
HWND hWnd = GetSafeHwnd() ;
HDC hDc = ::GetDC(hWnd) ;
wglMakeCurrent(hDc, m_hGLContext) ;
m_width = cx ;
m_height = cy ;
fAspect = (GLdouble)m_width /(GLdouble)m_height ;
if(m_width== 0 || m_width == 0)
return ;
glMatrixMode (GL_PROJECTION) ;
glLoadIdentity() ;
gluPerspective(40.0f, fAspect, 1.0f, 500.0f) ;
glViewport (0, 0, m_width, m_height) ;
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity() ;
}