open gl output in child windows
I am trying to write code for simulation program. The problem is this. Given number of particles and the energy of each particles, it will simulate according to it. So I have created Edit Box using "CreateWindow" command. The problem is that I don''t know how to create child window for graphical output. I tried using "static" first, but that''s no use. It seems that everyone is outputting their graphic to Parent window only.(I did some looking around.) could anyone help? Thanks in advance.
Both CreateWindow and CreateWindowEx have a field for a parent window. If you create a main window, and then in your WinProc, when you process the WM_CREATE message, you can create a second window with a second call to CreateWindow, using the first window as the parent. When I was working with this, I had a ton of problems keeping the device and rendering contexts correct for each window. You have to make sure you call wglMakeCurrent each time you repaint. NeHe''s new basecode works really well with this, so if you aren''t using it, I would definitely look at it. If you really want to make something work quickly, GLUT works really really well for multiple windows.
Thanks a lot. However, I have one more question. I tried what you just said, however, it failed. I think the parameters that I used were wrong. On the command "CreateWindow", does the child window get same parameters as the parent window on first parameter? (It is second parameter if I decide to use "CreateWindowEx".)
Good Question. I don''t know if you have to, but I do use seperate classes for each window, which means filling out and registering a seperate WNDCLASS for each with RegisterClass(). Also, in your message loop in WinMain (I assume) make sure you are calling the paint functions for both windows.
Hope this helps. If you still have trouble, I can probably put together an example.
Hope this helps. If you still have trouble, I can probably put together an example.
What? You can register two separate window class? Then do I not need to create two different Window Functions also? If you don''t mine, do you have an example code that I can look at? If you do, you can send me through e-mail as attatchment. Thanks a lot.
Yes, you can register different classes, and you do need two seperate WinProc functions, unless the windows operate identically.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement