hi xwb,
my compiler does not have the option to print the include files but we can see all the files in the same window that we are working..
here is my code for ARtookit (C program):
#ifdef _WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#ifndef __APPLE__
#include <GL/gl.h>
#include <GL/glut.h>
#else
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#endif
#include <AR/gsub.h>
#include <AR/video.h>
#include <AR/param.h>
#include <AR/ar.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "interface/src/callbacks.h"
#include "interface/src/interface.h"
#include "interface/src/support.h"
#ifdef G_OS_WIN32
gchar *package_prefix = "";
gchar *package_data_dir ="";
gchar *package_locale_dir = "";
#endif
/* set up the video format globals */
#ifdef _WIN32
char *vconf "Data\\WDM_camera_flipV.xml";
#else
char *vconf = "";
#endif
int xsize, ysize;
int thresh = 100;
int count = 0;
char *cparam_name = "Data/camera_para.dat";
ARParam cparam;
//original pattern
//char *patt_name = "Data/patt.hiro"; //change this line of code to point to a new pattern
/*MY PATTERNS*/
//char *patt_name = "Data/patt.slash"; //testing my first pattern
char *patt_name = "Data/patt.mypattern"; //testing my first pattern
int patt_id;
double patt_width = 80.0;
double patt_center[2] = {0.0, 0.0};
double patt_trans[3][4];
static void init(void);
static void cleanup(void);
static void keyEvent( unsigned char key, int x, int y);
static void mainLoop(void);
static void draw( void );
/****the main from another C program**********/
int main(int argc, char **argv)
{
GtkWidget *win_main;
win_main = create_win_main ();
gtk_widget_show (win_main);
g_signal_connect ((gpointer) win_main, "destroy", G_CALLBACK(gtk_main_quit),
NULL);
glutInit(&argc, argv);
init();
arVideoCapStart();
argMainLoop( NULL, keyEvent, mainLoop );
return (0);
}
static void keyEvent( unsigned char key, int x, int y)
{
/* quit if the ESC key is pressed */
if( key == 0x1b ) {
printf("*** %f (frame/sec)\n", (double)count/arUtilTimer());
cleanup();
exit(0);
}
}
/* main loop */
static void mainLoop(void)
{
ARUint8 *dataPtr;
ARMarkerInfo *marker_info;
int marker_num;
int j, k;
/* grab a vide frame */
if( (dataPtr = (ARUint8 *)arVideoGetImage()) == NULL ) {
arUtilSleep(2);
return;
}
if( count == 0 ) arUtilTimerReset();
count++;
argDrawMode2D();
argDispImage( dataPtr, 0,0 );
/* detect the markers in the video frame */
if( arDetectMarker(dataPtr, thresh, &marker_info, &marker_num) < 0 ) {
cleanup();
exit(0);
}
arVideoCapNext();
/* check for object visibility */
k = -1;
for( j = 0; j < marker_num; j++ ) {
if( patt_id == marker_info[j].id ) {
if( k == -1 ) k = j;
else if( marker_info[k].cf < marker_info[j].cf ) k = j;
}
}
if( k == -1 ) {
argSwapBuffers();
return;
}
/* get the transformation between the marker and the real camera */
arGetTransMat(&marker_info[k], patt_center, patt_width, patt_trans);
draw();
argSwapBuffers();
}
static void init( void )
{
ARParam wparam;
/* open the video path */
if( arVideoOpen( vconf ) < 0 ) exit(0);
/* find the size of the window */
if( arVideoInqSize(&xsize, &ysize) < 0 ) exit(0);
printf("Image size (x,y) = (%d,%d)\n", xsize, ysize);
/* set the initial camera parameters */
if( arParamLoad(cparam_name, 1, &wparam) < 0 ) {
printf("Camera parameter load error !!\n");
exit(0);
}
arParamChangeSize( &wparam, xsize, ysize, &cparam );
arInitCparam( &cparam );
printf("*** Camera Parameter ***\n");
arParamDisp( &cparam );
if( (patt_id=arLoadPatt(patt_name)) < 0 ) {
printf("pattern load error !!\n");
exit(0);
}
/* open the graphics window */
argInit( &cparam, 1.0, 0, 0, 0, 0 );
}
/* cleanup function called when program exits */
static void cleanup(void)
{
arVideoCapStop();
arVideoClose();
argCleanup();
}
static void draw( void )
{
double gl_para[16];
GLfloat mat_ambient[] = {0.0, 0.0, 1.0, 1.0};
GLfloat mat_flash[] = {0.0, 0.0, 1.0, 1.0};
GLfloat mat_flash_shiny[] = {50.0};
GLfloat light_position[] = {100.0,-200.0,200.0,0.0};
GLfloat ambi[] = {0.1, 0.1, 0.1, 0.1};
GLfloat lightZeroColor[] = {0.9, 0.9, 0.9, 0.1};
argDrawMode3D();
argDraw3dCamera( 0, 0 );
glClearDepth( 1.0 );
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
/* load the camera transformation matrix */
argConvGlpara(patt_trans, gl_para);
glMatrixMode(GL_MODELVIEW);
glLoadMatrixd( gl_para );
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_AMBIENT, ambi);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_flash);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_flash_shiny);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
glMatrixMode(GL_MODELVIEW);
glTranslatef( 0.0, 0.0, 25.0 );
//glutSolidCube(50.0);
//glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
glutSolidSphere(40, 20, 10);
glDisable( GL_LIGHTING );
glDisable( GL_DEPTH_TEST );
}
--------------------Configuration: simpleTest - Win32 Debug--------------------
Compiling...
main.c
c:\documents and settings\nitish\desktop\tt\artoolkit\examples\simple\interface\src\main.c(50) : error C2065: 'PACKAGE' : undeclared identifier
c:\documents and settings\nitish\desktop\tt\artoolkit\examples\simple\interface\src\main.c(71)
: warning C4022: 'g_free' : pointer mismatch for actual parameter 1
Error executing cl.exe.
simpleTestd.exe - 1 error(s), 1 warning(s)
well am trying to call the main from another program (Gtk) and i`ve comment it above...
here is the main file of the program (Gtk) which i want to call:
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "interface.h"
#include "support.h"
#ifdef G_OS_WIN32
gchar *package_prefix = "";
gchar *package_data_dir ="";
gchar *package_locale_dir = "";
#endif
int
/*mainn (int argc, char *argv[])*/
main (int argc, char *argv[])
{
GtkWidget *win_main;
gchar *pixmap_dir;
#ifdef G_OS_WIN32
package_prefix = g_win32_get_package_installation_directory (NULL, NULL);
package_data_dir = g_build_filename (package_prefix, "share", NULL);
package_locale_dir = g_build_filename (package_prefix, "share", "locale", NULL);
#endif
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, package_locale_dir);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
gtk_set_locale ();
gtk_init (&argc, &argv);
pixmap_dir = g_build_filename (package_data_dir, PACKAGE, "pixmaps", NULL);
add_pixmap_directory (pixmap_dir);
g_free (pixmap_dir);
/*
* The following code was added by Glade to create one of each component
* (except popup menus), just so that you see something after building
* the project. Delete any components that you don't want shown initially.
*/
win_main = create_win_main ();
gtk_widget_show (win_main);
g_signal_connect ((gpointer) win_main, "destroy", G_CALLBACK(gtk_main_quit),
NULL);
gtk_main ();
#ifdef G_OS_WIN32
g_free (package_prefix);
g_free (package_data_dir);
g_free (package_locale_dir);
g_free (PACKAGE);
#endif
return 0;
}
#ifdef _MSC_VER
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
/*return mainn (__argc, __argv);*/
return main (__argc, __argv);
}
#endif
any help is welcomed..thanks