• Advertisement

Archived

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

open gl output in child windows

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

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.

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Yes, you can register different classes, and you do need two seperate WinProc functions, unless the windows operate identically.

Share this post


Link to post
Share on other sites
thanks for you respond, but the file didn''t get through. I replied the email with my other email address. I am sorry, but could you send me one more time?
Thanks.

Share this post


Link to post
Share on other sites

  • Advertisement