Advertisement

Render Thread and C++ Classes

Started by June 22, 2001 01:58 PM
2 comments, last by Galileo430 23 years, 7 months ago
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?
------------------------------------------------------------I wrote the best video game ever, then I woke up...
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.
Advertisement
Ok, I did but now when I SwapBuffers(hDC); it crashs my computer.
------------------------------------------------------------I wrote the best video game ever, then I woke up...
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?

- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement