Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Luis Penaranda
panoramic
Commits
1286a1b2
Commit
1286a1b2
authored
Mar 01, 2013
by
Luis Penaranda
Browse files
small steps towards compiling on windows
parent
7ef25c01
Changes
2
Hide whitespace changes
Inline
Side-by-side
openglcanvas.cpp
View file @
1286a1b2
...
...
@@ -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
#include
<pwd.h>
// for getpwuid (TODO: windows?)
#ifndef _WIN32
# include <pwd.h> // for getpwuid (TODO: windows?)
#endif
#include
<cstdio>
// for fopen, fclose, getc
#include
<cstring>
#ifdef WIN
DOWS
#ifdef
_
WIN
32
#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
));
...
...
openglcanvas.h
View file @
1286a1b2
...
...
@@ -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"
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment