Archived

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

Galileo430

Render Thread and C++ Classes

Recommended Posts

Here''s the problem. I want my game to be framerate independant and to go for raw framerate. So I want to stick my rendering code in a seprate thread then my message handleing code. Now. I''ve done this before. HOWEVER, this is my first OOP OpenGL Engine. CMenu::Run() works like this... // init variables // start up CMenu::Render() in another thread // Do Message Loop // Once quit shutdown CMenu::Render() void CMenu::Render(); is a protected static member function. Now for some reason when I call either CreateThread or _beginthread. It can''t find Render! I always get compiler error C2440, No Function Within Scope Matchs Name Space. Does anyone know how to make it see this function?

Share this post


Link to post
Share on other sites
Where is this in the FAQ?

You can''t pass a member function to threads. You need to make your member function static, and pass in the CMenu object as the parameter so you can dereference the class members from within the function.

Share this post


Link to post
Share on other sites
Soo, was CMenu::Render() static to begin with or did you change it afterwards?

If you''re calling SwapBuffers in the message pump and in the render thread you may need to protect entry into it with a critical section.

Without seeing and testing alot of code it''s hard to tell what''s really wrong.

What''s CMenu do?

Share this post


Link to post
Share on other sites