From bf32dab70c13f1700137b51ad6ff1ca5f0f41070 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 14 Oct 2009 03:32:52 +0000 Subject: [PATCH] MULTITHREADING NOT WORKING - OpenGL calls do not work properly called from a thread different from the one that OpenGL was initialized in. But, I need SDL calls to be called from the thread that SDL was initialized in, which is the thread that initializes OpenGL. That means that in order to use multithreading all OpenGL and SDL calls would have to be done from the main thread and not from the lua thread. This means that every single draw operation would have to be passed from the lua thread to the main thread for execution. This is a bad idea. So, I am going to revert all of these changes for multithreading and look into lua_sethook() for handling infinite loops instead. git-svn-id: svn://anubis/anaglym/trunk@83 99a6e188-d820-4881-8870-2d33a10e2619 --- Engine.cc | 2 +- anaglym.cc | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Engine.cc b/Engine.cc index 4cdaaec..32efd04 100644 --- a/Engine.cc +++ b/Engine.cc @@ -210,7 +210,7 @@ void Engine::update() if (m_autoPhysics) doPhysics(); lua_getfield(m_luaState, LUA_GLOBALSINDEX, "update"); - if (lua_type(m_luaState, -1) == LUA_TFUNCTION) + if (lua_isfunction(m_luaState, -1)) { /* call the update function - pops the function ref from the stack */ int s = lua_pcall(m_luaState, 0, LUA_MULTRET, 0); diff --git a/anaglym.cc b/anaglym.cc index c03db9a..be741ad 100644 --- a/anaglym.cc +++ b/anaglym.cc @@ -79,8 +79,6 @@ static int engine_thread(void * param) { case EVENT_UPDATE: g_engine->update(); - GLUquadric * quad = gluNewQuadric(); - gluSphere(quad, 4.0, 16, 8); lastUpdateCompleted = true; break; } @@ -184,7 +182,6 @@ static void mainloop() case SDL_USEREVENT: if (event.user.code == 0) { - if (lastUpdateCompleted) SDL_GL_SwapBuffers(); update(); }