Archived

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

screens

This topic is 5270 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

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();

...

Share this post


Link to post
Share on other sites
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));
}

Share this post


Link to post
Share on other sites
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 .

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites

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 ...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
there is a tutorial over multiple viewports at NeHe''s. It''s on the last page of the tutorials.

Share this post


Link to post
Share on other sites
I think that what you really want to do is create 4 child windows within your main window, and then you obtain a rendering context for each window individually using the seperate HWND''s - this will give you 4 HLGRC''s. You have to bind each one with the wgl function wglMakeCurrent() with the appropriate render context when you want to render to each one. Note you need to look in to sharing resources if you want to be able to use the same texture''s etc.. in all 4 windows.

Share this post


Link to post
Share on other sites