Growing "transaction load" due to mainLoop
By jack | January 6, 2009
I have been working with ARToolkit for some months now, but I still fell I know nothing. I have been programming based on the "simple" example and everything worked fine, but I wanted to have a better user interface so I created a "Multiple Document Interface" (MDI) application with MS Visual c++ 6.0. The transition hasn't been neither easy nor intuitive.
Anyway, my problem now is that when I call argMainLoop with a very much like the simple example mainLoop function I have growing "transaction load". I'm sorry if that's not the correct expression, my english has some gaps, I hope it can still be understood. Looking for the problematic line I erased most of them, and it ended like follows:
static void mainLoop(void)
{
ARUint8 *dataPtr=NULL,*dataPtr1=NULL,*dataPtr2=NULL;
dataPtr1=(unsigned char *)malloc(xsize*ysize*4);
dataPtr2=(unsigned char *)malloc(xsize*ysize*4);
// grab a video frame
if( (dataPtr = (ARUint8 *)arVideoGetImage()) == NULL ) {
arUtilSleep(2);
return;
}
if( count == 0 ) arUtilTimerReset();
count++;
free(dataPtr1);
free(dataPtr2);
arVideoCapNext();
argSwapBuffers();
}
The problem should be with malloc-free, as it desapears when they are not in the code.
I don't understand why this is happening.
Even when I press "Esc" and stop capturing, the load still grows to infinity.
I'm desperate and can't find help anywhere.
Please, try to have a look at my problem.
Thanks in advance.
Kind regards,
Betty.
What libraries are missing?
For a "Multiple Document Interface" (MDI) application, you should not use the "simple" example, but instead the simpleLite example.
The reason is that the simple example uses the gsub library, which REQUIRES you to use GLUT, whereas the simpleLite example uses gsub_lite, which does not require you to use GLUT. Although the simpleLite example does still use GLUT, it is optional, and it is a lot easier to change from GLUT to some other windowing system.
The key things you need to do with ARToolKit, and where to find the code in simpleLite:
1) Init the camera, and load the markers: main()
2) Grab an image from the camera and process it for markers: Idle()
3) Redraw the image on the screen, including any objects on top of detected markers: Display()
Hope that helps.
I guess there'd be some others, but I don't know for sure as I can't continue compiling.
You know, I "installed" a year ago ARToolkit 2.65. I know the latest version is 2.71.3.
I tried compiling the simpleLite example but there were some libraries missing, is it because 2.71.3 is not a full release? I'm sorry, I am so lost when talking about libraries and releases :)
#If you have any other info about this subject , Please add it free.# |
Topics: enart.xn--fiqs8sjn5by0n.com | edit
