Jump to content
  • Advertisement
Sign in to follow this  
shane1985

OpenGL Some questions about OpenGL/Win32

This topic is 4808 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'm currently trying to create a popup dialog box with a picture control inside, where I will then render textured quads. The issue I'm running into is this: I don't know the hwnd of the control until the user opens the dialog box, so I can't initialize the OpenGL rendering context until this point. This means I have to load textures into the rendering context at the point too. If I only had to do it once, that would be fine, but it seems that when I close the dialog box, it destroys the rendering context. This requires me to recreate it, along with reloading all my textures every time the user opens the dialog box. Is there any easier way to do this? Thanks -Shane

Share this post


Link to post
Share on other sites
Advertisement
i and a couple have been dealing with this problem.
here is the link to the thread:
http://www.gamedev.net/community/forums/topic.asp?topic_id=319124

here is the link to codeproject that has a sample program:
http://www.codeproject.com/opengl/openglstruct.asp

Share this post


Link to post
Share on other sites
I did look at that thread - it seemed like you were just trying to render onto a dialog box that would be displayed for the entirety of the program's run time. I'm trying to figure out the best way to render onto a temporary popup dialog box.

Anyone have any ideas?

Thanks
-Shane

Share this post


Link to post
Share on other sites
Could you use the CreateDialog function? That would allow you to create your dialog box once when your program starts, do all your initialization in WM_INITDIALOG once, then hold on to the dialog box for the duration of the program. When you want the user to see your dialog box, call ShowWindow with the HWND you get back from CreateDialog, and when the user clicks the close button or Alt-F4, catch the WM_CLOSE message in the dialog's WndProc, and call HideWindow. At the end of your program, simply call DestroyWindow.

Share this post


Link to post
Share on other sites
Quote:
Original post by shane1985
Is there any easier way to do this?

wglShareLists() allows you to make display lists and textures available to a number of rendering contexts. You could probably create 'base' context when your program starts, then whenever a dialog box is created let the dialog's context 'tap' into the 'base' list with wglShare... The shared textures/display lists are supposed to exist until all contexts using them are destroyed so this'd possibly save you reloading them every time.

Share this post


Link to post
Share on other sites
Hey tolaris, thanks a lot!
That's what I was looking for.
Thanks to insanity's idea as well - that might come in useful in one of my other projects.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!