Split Windows with DirectX/OpenGL

Started by
4 comments, last by Ranok 24 years, 4 months ago
I'm not sure I fully understand the problem. When you create an instance of DirectDraw, you "attach" it to your window using SetCooperativeLevel(hWnd,.....)

If you want to limit the drawing area, just use a DirectDrawClipper. No?

Not sure how you'd do this in OpenGL though. I've never used it.

Advertisement
The problem is that there is one hWnd for the main Window and then each window of the slitter windows has it's own hWnd. For example: I create the main window and it has its own hWnd. I then create four more windows (one for each of the split windows) and each of them have their specific hWnd. So would I attach it to the main hWnd and limit the drawing area or would I attach it to one of the subwindows?
---Ranok---
I am doing the same thing. I have one parent window, and four child windows, i.e. one for 3D view, the other 3 for 3D planes. Just pass hWnd of the 3D view to DDraw or D3D. Now, when you draw on one window, repaint all four as well, and when the parent dies, it destroys all child windows automatically, but does send WM_DESTROY to each of its child. So, to recap: I have one parent class and one parent window, four independent child classes with four independent child windows each hooked to its own class, this way I can design each window in its own way independent of the others. Each child has its own wndproc() that gets called when you click in its window. I still can't get the tiling working, I think the TileWindows() works only with MDI frame/child windows, it would be nice if it worked with non-MDI windows so I wouldn't have to program resizing/tiling function. If anyone done this in win32 let me know. Thanks

Jerry

[This message has been edited by JD (edited December 13, 1999).]

I'm not positive of this because I have never tried it, but don't custom control have a Window handle. When I was in school we used borland C++ 4.5 and they were called custom windows.

[This message has been edited by Gromit (edited December 13, 1999).]

William Reiach - Human Extrodinaire

Marlene and Me


I am trying to implement a split window system common to many modeling packages and was wondering if anybody knows how you would go about setting up either DirectX or OpenGL to reder in only a single pane of one of the split windows. Any suggestions would be helpful because everything I have tried has failed quite pitifully.
---Ranok---
This is INCREDIBLY easy in Open GL. Since the majority of that API was designed to be used independant of windowing environments, you can stick opengl windows in anything you want, relatively easily. (combo box with a rotating 3d background, here I come. hehe)

what you need to do:
*On creation of the window, grab its HDC.
*Fill in a PIXELFORMATDESCRIPTOR structure. Its huge, and has tons of values. do a lot of research to determine what you need.
*use the ChoosePixelFormat()(or DescribePixelFormat()) and SetPixelFormat() functions with the HDC to describe the pixel capabilities for the drawing device.
*Use the wglCreateContext() function to set up OpenGL support on your HDC.
*Use the wglMakeCurrent() function to cause the OpenGl interface to draw on the DC.

From here, you start using OpenGl as normal. All OpenGL drawing functions will draw to that DC. The acutal use of OpenGl is better explained elsewhere. =)

Hope that is useful info...

------------------
*oof*

*oof*

This topic is closed to new replies.

Advertisement