I want to implement window program using openGL.
But… How is the size of window (only viewport)
set?
In openGL, I know that using
glutInitWindowSize(pixel_width, pixel_height);
can be implemented…
I want to implement window program using openGL.
But… How is the size of window (only viewport)
set?
In openGL, I know that using
glutInitWindowSize(pixel_width, pixel_height);
can be implemented…
u mean like this??
GLvoid ReSizeGLScene(int width, int height)
{
if(height==0)
height = 1; /don’t divide by zero/
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat) width/(GLfloat) height, 0.1f, 100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
gav
No… window’s size is constant.
Only… I want to know how to set the
window size(SDI application)
Set the window size? That can always be changing depending on the end user.
Or do you mean determining the viewport?
When application is executed at the first
time, window appears.
I know the function, movewindow.
But this function sets the whole window’s
size(view+menu bar…etc.)
I want to know how to set only view size
(the part of drawing actually)
Please…
Ahh so you want to set the drawable area within the window, i.e so you could split the window into 4 panes or something similar?
Once the window has been created or resized, use GetClientRect(HWND hWnd, LPRECT rect) (Windows API) to get the size of the client area - that’s the area within the frame where you’ll be drawing.