Hack for the glutMainloop ON Mac

Does anyone know what particular change I must make to the glutmainloop that I can use the mainloop of my program…
Here is the Code…

void glutMainLoop(void)
{
#if !TARGET_API_MAC_CARBON
GLUTwindow *glut_win;
#endif

if(!__glutWindowListSize)
{
	__glutFatalUsage("main loop entered with no windows created.");
}

#if TARGET_API_MAC_CARBON
InstallEventLoopTimer (GetCurrentEventLoop(), 0, 0.000001, GetTimerUPP (), 0, &gTimer);
#endif
while (!gQuit)
{
/* Process OS events */
processEvents();

#if !TARGET_API_MAC_CARBON
/* Process work list */
if(__glutWindowWorkList)
{
glut_win = __glutWindowWorkList;
__glutWindowWorkList = NULL;

		processWindowWorkList(glut_win);
	}
	
	/* If idle */
	if(__glutIdleFunc)
	{
		if(__glutCurrentWindow)
		{
			__glutIdleFunc();
		}
	}
	
	/* If timer list */
	if(__glutTimerList) handleTimeouts();

#endif
}
#if TARGET_API_MAC_CARBON
RemoveEventLoopTimer(gTimer);
gTimer = NULL;
#endif

}
Thank you very much.

Why do you need to do such a bizarre thing? What on earth do you need to do that can’t be done in the standard GLUT way?

This another way of doing but it seems as if the glutCheckLoop() and glutNWcloseFunc() is only mac X and windows…so I have to try and hack glutMainloop since I am working in Mac OS 9…do you know an easier way to hack the glutmainloop.

#ifndef GLUTCHECKLOOP
glutMainLoop(); /* This is the normal unadulterated event loop /
#else
for(; {
glutCheckLoop();
/
You can put your own stuff in here if you want!!! */ }
#endif
return 1;

}

You still haven’t answered why you would need to do that; how is putting code in there different from putting it in your idle callback?

Sorry it took me so long to answer your question… I have a program I wrote to do many other things. But when I use OpenGl to draw my 3d shape and try to quit then the whole program quit. I was trying find away to quit the glutmainloop without exist my program…I am presently expolring context windowing…hopely there is something here.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.