Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
panoramic
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Luis Penaranda
panoramic
Commits
2d6af942
Commit
2d6af942
authored
Jan 07, 2013
by
Luis Peñaranda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added button to choose input file
parent
a0bebcd6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
31 deletions
+55
-31
openglcanvas.cpp
openglcanvas.cpp
+24
-22
openglcanvas.h
openglcanvas.h
+2
-2
panowindow1.h
panowindow1.h
+0
-1
panowindow1.ui
panowindow1.ui
+29
-6
No files found.
openglcanvas.cpp
View file @
2d6af942
#include <QtGui>
#ifdef NEEDGLEE
#include "GLee.h"
#include "GLee.h"
#endif
#include "openglcanvas.h"
#include <cmath>
...
...
@@ -34,7 +34,6 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
time_timer
.
setInterval
(
0
);
connect
(
&
time_timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
slotTimer
()));
time_start
=
time_time
.
time
();
}
void
OpenGLCanvas
::
slotTimer
(
void
)
{
...
...
@@ -104,14 +103,27 @@ void OpenGLCanvas::change_fov_scale_relation(QString name){
void
OpenGLCanvas
::
change_visualization
(
QString
name
){
visualization
=
name
;
updateGL
();
updateGL
();
}
void
OpenGLCanvas
::
load_image
(
const
char
*
new_image
){
const
char
*
const
progname
=
(
char
*
)(
PROGNAME
);
int
textureSize
=
getTextureSize
(
progname
,
new_image
);
unsigned
char
*
textureBytes
=
(
unsigned
char
*
)
malloc
(
textureSize
);
int
width
,
height
;
readTextureBytes
(
progname
,
new_image
,
textureBytes
,
&
width
,
&
height
);
glPixelStorei
(
GL_UNPACK_ALIGNMENT
,
1
);
GLuint
tex
;
glGenTextures
(
1
,
&
tex
);
glBindTexture
(
GL_TEXTURE_2D
,
tex
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
GL_RGB
,
width
,
height
,
0
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
textureBytes
);
}
void
OpenGLCanvas
::
change_input_image
(){
QString
path
=
QFileDialog
::
getExistingDirectory
(
this
,
tr
(
"Choose directory"
),
directory
.
path
());
if
(
path
.
isNull
()
==
false
)
directory
.
setPath
(
path
);
load_image
(
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose Panorama File"
)).
toStdString
().
c_str
());
updateGL
();
}
...
...
@@ -137,27 +149,17 @@ void OpenGLCanvas::initializeGL(){
#endif
fprintf
(
stderr
,
"progname=%s
\n
"
,
progname
);
fprintf
(
stderr
,
"image=%s
\n
"
,
input_image
);
//
exit
if the input file does not exist
fprintf
(
stderr
,
"
default
image=%s
\n
"
,
input_image
);
//
what to do
if the input file does not exist
struct
stat
testbuf
;
if
(
stat
(
input_image
,
&
testbuf
)){
fprintf
(
stderr
,
"the file does not exist!
\n
"
);
fprintf
(
stderr
,
"the
default image
file does not exist!
\n
"
);
free
(
input_image
);
exit
(
-
1
);
load_image
(
QFileDialog
::
getOpenFileName
(
this
,
tr
(
"Choose Panorama File"
)).
toStdString
().
c_str
());
}
else
{
load_image
(
input_image
);
}
int
textureSize
=
getTextureSize
(
progname
,
input_image
);
unsigned
char
*
textureBytes
=
(
unsigned
char
*
)
malloc
(
textureSize
);
int
width
,
height
;
readTextureBytes
(
progname
,
input_image
,
textureBytes
,
&
width
,
&
height
);
glPixelStorei
(
GL_UNPACK_ALIGNMENT
,
1
);
GLuint
tex
;
glGenTextures
(
1
,
&
tex
);
glBindTexture
(
GL_TEXTURE_2D
,
tex
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
GL_RGB
,
width
,
height
,
0
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
textureBytes
);
// mesh resolution
int
m
,
n
;
m
=
n
=
100
;
...
...
openglcanvas.h
View file @
2d6af942
...
...
@@ -33,7 +33,7 @@ extern "C" {
#include <GL/glext.h>
#endif
#include <Q
Dir
>
#include <Q
File
>
#include <QFileDialog>
class
OpenGLCanvas
:
public
QGLWidget
...
...
@@ -43,6 +43,7 @@ public:
explicit
OpenGLCanvas
(
QWidget
*
parent
=
0
);
protected:
void
load_image
(
const
char
*
new_image
);
void
initializeGL
();
void
resizeGL
(
int
w
,
int
h
);
void
paintGL
();
...
...
@@ -76,7 +77,6 @@ private:
double
center_phi
;
QString
fov_scale_relation
;
QString
visualization
;
QDir
directory
;
Chronos
time_time
;
QTimer
time_timer
;
...
...
panowindow1.h
View file @
2d6af942
...
...
@@ -18,5 +18,4 @@ public:
private:
Ui
::
PanoWindow1
*
ui
;
};
#endif // PANOWINDOW1_H
panowindow1.ui
View file @
2d6af942
...
...
@@ -14,7 +14,7 @@
<string>
PanoWindow1
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
rowspan=
"1
0
"
>
<item
row=
"0"
column=
"0"
rowspan=
"1
2
"
>
<widget
class=
"OpenGLCanvas"
name=
"GLCanvas"
native=
"true"
/>
</item>
<item
row=
"0"
column=
"1"
colspan=
"2"
>
...
...
@@ -115,7 +115,7 @@
</property>
</widget>
</item>
<item
row=
"
7
"
column=
"1"
>
<item
row=
"
8
"
column=
"1"
>
<widget
class=
"QDoubleSpinBox"
name=
"doubleSpinBox_3"
>
<property
name=
"maximumSize"
>
<size>
...
...
@@ -134,7 +134,7 @@
</property>
</widget>
</item>
<item
row=
"
7
"
column=
"2"
>
<item
row=
"
8
"
column=
"2"
>
<widget
class=
"QDoubleSpinBox"
name=
"doubleSpinBox_4"
>
<property
name=
"maximumSize"
>
<size>
...
...
@@ -153,7 +153,14 @@
</property>
</widget>
</item>
<item
row=
"8"
column=
"2"
>
<item
row=
"9"
column=
"1"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"chooseFile"
>
<property
name=
"text"
>
<string>
Input Image
</string>
</property>
</widget>
</item>
<item
row=
"10"
column=
"2"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -166,7 +173,7 @@
</property>
</spacer>
</item>
<item
row=
"
9
"
column=
"1"
colspan=
"2"
>
<item
row=
"
11
"
column=
"1"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"text"
>
<string>
Close
</string>
...
...
@@ -180,7 +187,7 @@
<customwidget>
<class>
OpenGLCanvas
</class>
<extends>
QWidget
</extends>
<header>
openglcanvas.h
</header>
<header
location=
"global"
>
openglcanvas.h
</header>
<container>
1
</container>
<slots>
<slot>
change_fov(double)
</slot>
...
...
@@ -290,5 +297,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>
chooseFile
</sender>
<signal>
clicked()
</signal>
<receiver>
GLCanvas
</receiver>
<slot>
change_input_image()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
566
</x>
<y>
258
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
247
</x>
<y>
249
</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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