PDA

View Full Version : MFC & openGL



09-04-2000, 05:05 AM
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...

fox
09-04-2000, 05:37 AM
there's a tutorial at www.devcentral.com (http://www.devcentral.com) on this

Gavin
09-04-2000, 05:53 AM
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

09-04-2000, 06:08 AM
No... window's size is constant.

Only.... I want to know how to set the

window size(SDI application)

Diego
09-04-2000, 06:31 AM
Set the window size? That can always be changing depending on the end user.
Or do you mean determining the viewport?

09-04-2000, 08:10 AM
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..

Gavin
09-04-2000, 11:54 AM
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?

09-04-2000, 12:03 PM
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.