PDA

View Full Version : Please help me....Help



hcrogma
04-24-2003, 06:06 AM
Could you please tell me if the following change to the glut event.c is correct to hack the glutmainloop on the the mac...
If this is not correct I also include the exact code for the glutmainloop on the Mac...It is at the end....So if what I did is incorrect please make changes to the code at end....that I may achieve this hack...Thank you


void glutMainLoop(void)
{


while (!gQuit)
{
glutMainLoopUpdate();
}


}

//----------------------------------------------------------------------
void glutMainLoopUpdate(void)
{

while (!gQuit)
{

#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

/* 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

}

Mac....glutMainLoop..


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

mikael_aronsson
04-24-2003, 10:07 PM
Hi !

Does it work or not ? if it doesn't it would help if you gave some clue on what the problem might be ?

Mikael