Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Metal Typhoon

How do i get some info from the window ??

This topic is 5831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using win32 api to create my window. i need the width . can wparam or lparam send me this message?? or am i totaly wrong in what i''m doing?? i need the width and height of the window and be able to resize it. thx alot

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Prosper/LOADED
From the MSDN :

The WM_SIZE message is sent to a window after its size has changed.

WM_SIZE
fwSizeType = wParam; // resizing flag
nWidth = LOWORD(lParam); // width of client area
nHeight = HIWORD(lParam); // height of client area

RTFM at http://msdn.microsoft.com



my prob is thata i have a window using opengl that is 300x300 when i resize it it need to set glViewPort and gluPerspective to the size of the window. So would this solve my prob ?


    
//in the window proc

case WM_SIZE:
glViewPort(0,0,/*width*/LOWORD(lParam),/*height*/HIWORD(lparam));
gluPerspective(0.45f,(GLfloat) LOWORD(lParam) / (GLfloat) HIWORD(lParam),0.1f,100.0f);
break;




[edited by - Metal Typhoon on June 7, 2002 1:46:17 PM]

Share this post


Link to post
Share on other sites
If you really wanna. I do it like this:

ErrorCode CEngine::SizeOpenGL()
{
RECT WindowRect;
GetClientRect(WindowHandle, &WindowRect);

glViewport(0, 0, WindowRect.right, WindowRect.bottom);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

//insert perspective calculations (gluPerspective, etc.)

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

return CAFFEINE_OK;
}


Then, call SizeOGL() when you receive the WM_SIZE message.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

Share this post


Link to post
Share on other sites
quote:
Original post by ZealousElixir
If you really wanna. I do it like this:

ErrorCode CEngine::SizeOpenGL()
{
RECT WindowRect;
GetClientRect(WindowHandle, &WindowRect);

glViewport(0, 0, WindowRect.right, WindowRect.bottom);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

//insert perspective calculations (gluPerspective, etc.)

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

return CAFFEINE_OK;
}


Then, call SizeOGL() when you receive the WM_SIZE message.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links



i didn''t know how to use RECT so NOw i now
GetClientRect(hWnd,&WindowRect) will return me the top,left,widtrh and height of the window right ?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!