screens

Started by
10 comments, last by hello_there 20 years, 9 months ago
i want to have 4 windows on the screen in my application and i was wondering how to do it. anyone know?
____________________________________________________________How could hell be worse?
Advertisement
Well you can create 4 real windows, but probably you want something like 3DSmax, with four different views in the same window ?
If it''s what you want, you can draw your scene with different view angles (top, left etc ...) in as many viewports as you want.

glViewPort(MyTopView);
DrawtopScene();

glViewPort(MyLeftView);
DrawLeftScene();

...
Sphax
This is my wndproc function how would i change it so it would have 4 windows on the screen. or would you have to change something else as well?

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HGLRC hRC;
static HDC hDC;
int width,height;

switch(message)
{

case WM_CREATE: // window is being created

hDC = GetDC(hwnd);
g_hdc = hDC;
setuppixelformat(hDC);

hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC,hRC);

return 0;
break;

case WM_CLOSE: // windows is closing

wglMakeCurrent(hDC,NULL);
wglDeleteContext(hRC);

PostQuitMessage(0);
return 0;
break;

case WM_SIZE:

height = HIWORD(lParam);
width = LOWORD(lParam);

if(height == 0)
{
height = 1;
}

glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

gluPerspective(54.0f,(GLfloat)width/(GLfloat)height,0.1f,1000.0f);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

return 0;
break;

default:
break;
}

return (DefWindowProc(hwnd, message, wParam, lParam));
}
____________________________________________________________How could hell be worse?
If you want 4 windows (and not 4 viewPorts in one window), i can''t help you, since i always need only one window. I''m not really good with windows programming, but may be you ll have to create a parent window and 3 childs, nothing to do with your WndProc, but i let more competent people explain you that in details .
Sphax
i want it like 3d studio max 5''s thing but i only know limited windows programming. i don''t want it as advanced as that just a full screen programe with for viewing windows like top left etc. i know you can put different numbers in the glViewport(); funstion to move the viewport but how do you make 4 of them?
____________________________________________________________How could hell be worse?
In this case (one window with four viewports) you can do just like i said before : in your drawing routine, call glViewport with the correct parameters as many time as you want.

void MyDrawingFunction()
{
glViewport(viewport settings 1)
DrawScene1()

glViewport(viewport settings 2)
DrawScene2()

etc..
}

My english is not really good, may be it''s not clear ?
Sphax
ohhh so would you do this in the main loop not in wnd proc?
____________________________________________________________How could hell be worse?
well that worked. how do you get a mouse to move over all the screen and not just one of them.
____________________________________________________________How could hell be worse?

Sorry but i really don''t understand what you really want and what you are doing ...

If you have only one window with four viewports, then what''s the problem with your mouse ? One window, one WndProc (and one mouse ) , all is ok ...

If you have four windows, then you should have 4 WndProc, one for each window, or only one WndProc but with a switch statement inside with one case per window. But again, i''m not really good at windows programming ...
Sphax
if you want to create a 4 window splitt screen like most editors have it
then search the articles section toolsprogramming
for Creating 3D tools with MFC

nice and easy tutorial and btw MFC is really easy
you just need to get use to their message map concepts
http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement