diff --git a/openglcanvas.cpp b/openglcanvas.cpp index 23c0bed5244fd3e95cf4cd0d1095002459daf7ae..ac15b901b7591ce41d4e5e78b8a341d20f3d3be3 100644 --- a/openglcanvas.cpp +++ b/openglcanvas.cpp @@ -4,13 +4,14 @@ #endif #include "openglcanvas.h" #include -#include // for getcwd, getpwuid, getuid #include // for fstat, getpwuid, getuid #include // for fstat -#include // for getpwuid (TODO: windows?) +#ifndef _WIN32 +# include // for getpwuid (TODO: windows?) +#endif #include // for fopen, fclose, getc #include -#ifdef WINDOWS +#ifdef _WIN32 #include #define GET_WORKDIR _getcwd #else @@ -22,10 +23,14 @@ #define VERT_SHADER_FILE "test_vertex_shader.vert" #define FRAG_SHADER_FILE "fragment_shader.frag" -#define CONST_PI (0x1.921fb54442d18p+1) -#define CONST_PI_2 (0x1.921fb54442d18p+0) -#define CONST_PI_F (0x1.921fb6p+1) -#define CONST_PI_2_F (0x1.921fb6p+0) +#define CONST_PI 3.141592653589793115997963468544185161590576171875 +#define CONST_PI_2 1.5707963267948965579989817342720925807952880859375 +#define CONST_PI_F 3.1415927410125732421875f +#define CONST_PI_2_F 1.57079637050628662109375f +//#define CONST_PI (0x1.921fb54442d18p+1) +//#define CONST_PI_2 (0x1.921fb54442d18p+0) +//#define CONST_PI_F (0x1.921fb6p+1f) +//#define CONST_PI_2_F (0x1.921fb6p+0f) OpenGLCanvas::OpenGLCanvas(QWidget *parent) : QGLWidget(parent) @@ -188,9 +193,20 @@ void OpenGLCanvas::change_visualization(QString name){ // options in private variables. // TODO: windows void OpenGLCanvas::read_config_file(){ +#ifdef _WIN32 + char *filepath=(char*)malloc(512*sizeof(char)); + if(!GET_WORKDIR(filepath,512)){ + fprintf(stderr,"error reading config file\n"); + exit(-1); + } + strcat(filepath,"/panorc"); + // TODO +#else struct passwd *pw=getpwuid(getuid()); char *filepath=pw->pw_dir; strcat(filepath,"/.panorc"); +#endif + fprintf(stderr,"the user config file is %s\n",filepath); shader_dir=(char*)malloc(512*sizeof(char)); shader_dir[0]='\0'; input_image_file=(char*)malloc(512*sizeof(char)); diff --git a/openglcanvas.h b/openglcanvas.h index eefb5db321f92316dcc9c3447d74e96c4988867e..fa8c3fce4d4e0d445fb82f431d2c667bddb5141d 100644 --- a/openglcanvas.h +++ b/openglcanvas.h @@ -19,7 +19,8 @@ #include #include #include - #include + // is glext really needed? + //#include #endif #include @@ -27,7 +28,11 @@ #include #include #include -#include +#ifdef _WIN32 + #include +#else + #include // for getcwd, getpwuid, getuid +#endif #include "chronos.h" extern "C" {