Commit 1286a1b2 authored by Luis Penaranda's avatar Luis Penaranda
Browse files

small steps towards compiling on windows

parent 7ef25c01
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
@@ -4,13 +4,14 @@
#endif
#include "openglcanvas.h"
#include <cmath>
#include <unistd.h>     // for getcwd, getpwuid, getuid
#include <sys/types.h>  // for fstat, getpwuid, getuid
#include <sys/stat.h>   // for fstat
#ifndef _WIN32
#  include <pwd.h>        // for getpwuid (TODO: windows?)
#endif
#include <cstdio>       // for fopen, fclose, getc
#include <cstring>
#ifdef WINDOWS
#ifdef _WIN32
  #include <direct.h>
  #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));
+7 −2
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@
  #include <GL/gl.h>
  #include <GL/glu.h>
  #include <GL/glut.h>
  #include <GL/glext.h>
  // is glext really needed?
  //#include <GL/glext.h>
#endif

#include <QGLWidget>
@@ -27,7 +28,11 @@
#include <QFile>
#include <QFileDialog>
#include <fcntl.h>
#include <unistd.h>
#ifdef _WIN32
  #include <io.h>
#else
  #include <unistd.h>   // for getcwd, getpwuid, getuid
#endif
#include "chronos.h"

extern "C" {