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
This commit is contained in:
parent
e7d5e6eed1
commit
bf32dab70c
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user