Jump to content
  • Advertisement

Archived

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

Badone

OpenGL OpenGL Window Wrapper

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

Hi, I''m creating a wrapper for an opengl window so it will be easier for me in the future. I''m trying to figure out the best way to do the WndProc. I know that static works and all, but with NeHe''s code, he accesses variables like active during the WndProc and it won''t work since it can''t access a non-static variable. Does anyone have some suggestions on how to get this to work? I''ve seen some old threads that use a lot of pointers and stuff, but it just looks too messy and I don''t know if it would work with my wrapper code so far. Maybe someone has found a new way since those threads? I just want to keep WndProc in the class so that I can use the member variables and get it out of my main program. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Thx for the offer, but I don''t really need the whole thing. It''s done, I just need help with the WndProc.

Share this post


Link to post
Share on other sites
Router somethingsomething...

Basically, if you''re willing to make your opengl window class a Singleton, you can have a static member message router that you assign to your lpfnWndProc which then detects the validity of the Instance pointer and calls the non-static actual WndProc.

Ask if you need clarification.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

Share this post


Link to post
Share on other sites
That's not exactly what I was suggesting, but that is a valid method, if you take into consideration the suggestions further down in the thread. I'll hack together some code and show you what I mean. Gimme a couple hours.

EDIT : Yeah. Get it here. Enjoy.

EDIT 2: Oops! There's an error in the MessageHandler function:

if(Message == WM_CLOSE)
    PostQuitMessage(0);

should be replaced by

if(Message == WM_CLOSE)
{
    PostQuitMessage(0);
    return 0;
}



Peace,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links


[edited by - zealouselixir on September 1, 2002 6:06:53 PM]

[edited by - zealouselixir on September 1, 2002 6:37:04 PM]

Share this post


Link to post
Share on other sites

  • 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!