/** * Main */ int main (int argc, char **argv) { const char *libver; const char *progver; #if defined(_ANDROID) int tempIsAndroid = 1 ; #else int tempIsAndroid = 0 ; #endif char consoleBuffer[200]; fwl_init_instance(); //before setting any structs we need a struct allocated fwl_ConsoleSetup(MC_DEF_AQUA , MC_TARGET_AQUA , MC_HAVE_MOTIF , MC_TARGET_MOTIF , MC_MSC_HAVE_VER , tempIsAndroid); /* first, get the FreeWRL shared lib, and verify the version. */ libver = libFreeWRL_get_version(); progver = freewrl_get_version(); if (strcmp(progver, libver)) { sprintf(consoleBuffer ,"FreeWRL expected library version %s, got %s...\n",progver, libver); fwl_StringConsoleMessage(consoleBuffer); } #ifdef _MSC_VER /* Set fonts directory ideally we would check if we are in a) projectfiles go ../../fonts b) else c:/windows/Fonts */ if(strstr(argv[0],"projectfiles")) { /* we are testing - use local fonts (may be obsolete someday) */ static char *fdir; fdir = malloc(MAX_PATH); strcpy(fdir,"FREEWRL_FONTS_DIR="); strcat(fdir,"C:/fonts"); _putenv( fdir ); } else { /* deployed system (with intalled fonts) - use system fonts we plan to use a professional installer to install the fonts to %windir%\Fonts directory where all the system fonts already are. Then in this program we will get the %windir%\Fonts directory, and set it as temporary environment variable for InputFunctions.C > makeFontsDirectory() to fetch. */ static char *fdir; char *syspath; syspath = getenv("windir"); printf("windir path=[%s]\n",syspath); fdir = malloc(MAX_PATH); strcpy(fdir,"FREEWRL_FONTS_DIR="); strcat(fdir,syspath); strcat(fdir,"/Fonts"); _putenv( fdir ); } get_current_dir(); /* VBO preference - comment out for vbos (vertex buffer objects - a rendering optimization) */ _putenv("FREEWRL_NO_VBOS=1"); //_putenv("FREEWRL_USE_VBOS=1"); #endif /* install the signal handlers */ signal(SIGTERM, (void(*)(int)) fv_catch_SIGQUIT); signal(SIGSEGV, (void(*)(int)) fv_catch_SIGSEGV); #if !defined(CYGWIN) signal(SIGQUIT, (void(*)(int)) fv_catch_SIGQUIT); signal(SIGALRM, (void(*)(int)) fv_catch_SIGALRM); signal(SIGHUP, (void(*)(int)) fv_catch_SIGHUP); #endif /* Before we parse the command line, setup the FreeWRL default parameters */ fv_params = calloc(1, sizeof(freewrl_params_t)); /* Default values */ fv_params->width = 600; fv_params->height = 400; fv_params->eai = FALSE; fv_params->fullscreen = FALSE; fv_params->winToEmbedInto = -1; fv_params->verbose = FALSE; // fv_params->collision = 1; // if you set it, you need to update ui button with a call //setMenuButton_collision(fv_params->collision); //fwl_init_StereoDefaults(); /* parse command line arguments */ if (fv_parseCommandLine(argc, argv)) { if(argc > 1) { start_url = argv[optind]; #ifdef _MSC_VER start_url = strBackslash2fore(start_url); #endif } else { start_url = NULL; } } /* doug- redirect stdout to a file - works, useful for sending bug reports */ /*freopen("freopen.txt", "w", stdout ); */ /* Put env parse here, because this gives systems that do not have env vars the chance to do it their own way. */ fv_parseEnvVars(); /* start threads, parse initial scene, etc */ if ( 1 == 1) { /* give control to the library */ if (!fwl_initFreeWRL(fv_params)) { ERROR_MSG("main: aborting during initialization.\n"); exit(1); } fwl_startFreeWRL(start_url); } else { /* keep control if (!fv_initFreeWRL(fv_params)) { ERROR_MSG("main: aborting during initialization.\n"); exit(1); } fv_startFreeWRL(start_url); */ } return 0; }
//void initStaticStatusbar(); int fwInit ( ESContext *esContext ) { freewrl_params_t *fv_params = NULL; fv_params = calloc(1, sizeof(freewrl_params_t)); /* Default values */ fv_params->width = esContext->width; //600; fv_params->height = esContext->height; //400; //fv_params->eai = FALSE; fv_params->fullscreen = FALSE; fv_params->winToEmbedInto = INT_ID_UNDEFINED; fv_params->verbose = FALSE; fv_params->frontend_handles_display_thread = TRUE; //fv_params->collision = 1; // if you set it, you need to update ui button with a call //setMenuButton_collision(fv_params->collision); if(!fwl_initFreeWRL(fv_params)) return FALSE; //fwl_registerFunction("Replace","setWindowTitle",setWindowTitleFE); /* Hmm. display_initialize is really a frontend function. The frontend should call it before calling _displayThread */ /* Initialize display */ //initStaticStatusbar(); //call early for console_message if (!fv_display_initialize()) { printf("initFreeWRL: error in display initialization.\n"); return(0); } //fwl_init_SideBySide(); //works but needs base adjustment //fwl_startFreeWRL(""); //fwl_startFreeWRL("E:/source2/tests/4.wrl"); //fwl_startFreeWRL("E:/source2/tests/6.wrl"); //fwl_startFreeWRL("E:/source2/tests/11.wrl"); //fwl_startFreeWRL("E:/source2/tests/15.wrl"); //fwl_startFreeWRL("E:/source2/tests/16.wrl"); //fwl_startFreeWRL("E:/source2/tests/20.wrl"); //fwl_startFreeWRL("E:/source2/tests/51.wrl"); //fwl_startFreeWRL("E:/source2/tests/ProgrammableShaders/models/flutter2-ProgramShader.x3d"); //fwl_startFreeWRL("E:/source2/tests/ProgrammableShaders/models/teapot-Toon.wrl"); //fwl_startFreeWRL("E:/source2/tests/ProgrammableShaders/models/TwoCylinders.wrl"); //fwl_startFreeWRL("E:/source2/placeholders/townsite/townsite_withHud.x3d"); fwl_startFreeWRL("E:/source2/tests/Roelofs/43487/43487-galaxies.wrl"); //fwl_startFreeWRL("E:/source2/tests/21.x3d"); //fwl_startFreeWRL("E:/source2/tests/1.x3d"); //fwl_startFreeWRL("E:/source2/placeholders/townsite/townsite.x3d"); //fwl_startFreeWRL("E:/ACC/blenderBugs/LinkBug/more/Rest248_PlutoMod.x3d"); //fwl_startFreeWRL("E:/source2/tests/shaders/Door248_PlutoMod.x3d"); //fwl_startFreeWRL("E:/source2/tests/1_IFS.x3d"); //fwl_startFreeWRL("E:/source2/tests/blender/cone_lamp4.x3d"); //fwl_startFreeWRL("E:/source2/tests/blender/cone.x3d"); //fwl_startFreeWRL("E:/source2/tests/Dave_exposedField/jtest.wrl"); //fwl_startFreeWRL("E:/source2/tests/shaders/oneTexOneMaterial.x3d"); //fwl_startFreeWRL("http://dug9.users.sourceforge.net/web3d/tests/1.x3d"); //fwl_startFreeWRL("http://dug9.users.sourceforge.net/web3d/tests/2.x3d"); //fwl_startFreeWRL("http://dug9.users.sourceforge.net/web3d/tests/49.x3d"); //fwl_startFreeWRL("http://dug9.users.sourceforge.net/gravity.x3d"); //fwl_startFreeWRL("http://dug9.users.sourceforge.net/web3d/townsite/townsite.x3d"); //fwl_startFreeWRL("http://dug9.users.sourceforge.net/web3d/townsite/townsite_withHudfw.x3d"); //fwl_startFreeWRL("E:/source2/tests/Roelofs/Roelofs_concaveFace_JASversion.wrl"); //fwl_startFreeWRL("E:/source2/tests/Roelofs/Roelofs_concaveFace.x3d"); //fwl_startFreeWRL("E:/source2/freewrl/Generic/winGLES2/HudIcons.wrl"); fwl_initializeRenderSceneUpdateScene(); return 1; }