Original Post
I have a public pointer to an object of type Terrain:
Terrain terrainObj;
Terrain * pTerrain = &terrainObj
In my MFC / OpenGL app initialization I want to call the Terrain object''s time consuming load() method to work in the background. I''m using this code:
_beginthread(LoadTerrain, 0, g_pclGLView); // g_pclGLView is a pointer to my OpenGLWindow.
...
void LoadTerrain(LPVOID pParam)
{
COpenGLWindow* pWnd = (COpenGLWindow*)pParam;
pWnd->Init(); // Init() calls the Terrain object''s time consuming load() method.
pWnd->terrainLoaded = true;
}
When the terrainLoaded flag is set, I want to start my normal drawing loop, but when I do so, my terrain stuff isn''t displayed. I''m guessing it''s something to do with the thread because when I just call
LoadTerrain(g_pclGLView);
instead of _beginthread(...), the terrain shows up fine.
Does anyone have any ideas??
Thanks,
Matt