From 1286a1b2e8d73dbc8922a98dbf6c0ac8af6a7a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Fri, 1 Mar 2013 18:31:09 -0300 Subject: [PATCH] small steps towards compiling on windows --- openglcanvas.cpp | 30 +++++++++++++++++++++++------- openglcanvas.h | 9 +++++++-- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/openglcanvas.cpp b/openglcanvas.cpp index 23c0bed..ac15b90 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 eefb5db..fa8c3fc 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" { -- GitLab