Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
f6670510
Commit
f6670510
authored
Feb 06, 2019
by
Jan Möbius
Browse files
Removed old glut viewers.
parent
b17ce782
Changes
5
Hide whitespace changes
Inline
Side-by-side
libs_required/ACG/CMakeLists.txt
View file @
f6670510
...
...
@@ -87,7 +87,6 @@ set (directories
Geometry/Types
Geometry/bsp
GL
Glut
IO
Math
QtWidgets
...
...
libs_required/ACG/Glut/GlutExaminer.cc
deleted
100644 → 0
View file @
b17ce782
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS GlutExaminer - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
#include
"GlutExaminer.hh"
#include
"../Utils/StopWatch.hh"
//== NAMESPACES ===============================================================
namespace
ACG
{
//== IMPLEMENTATION ==========================================================
GlutExaminer
::
GlutExaminer
(
const
char
*
_title
,
int
_width
,
int
_height
)
:
GlutViewer
(
_title
,
_width
,
_height
),
trackball_
(
glstate_
),
center_
(
Vec3f
(
0.0
,
0.0
,
0.0
)),
radius_
(
1.0
)
{
init
();
}
//-----------------------------------------------------------------------------
void
GlutExaminer
::
init
()
{
trackball_
.
set_center
(
Vec3f
(
0
,
0
,
0
));
}
//-----------------------------------------------------------------------------
void
GlutExaminer
::
draw
()
{
ACG
::
GLState
::
enable
(
GL_LIGHTING
);
ACG
::
GLState
::
shadeModel
(
GL_SMOOTH
);
glutSolidTeapot
(
0.5
);
}
//-----------------------------------------------------------------------------
void
GlutExaminer
::
mouse
(
int
button
,
int
state
,
int
x
,
int
y
)
{
if
(
state
==
GLUT_DOWN
)
trackball_
.
mouse_press
(
button
,
x
,
y
);
else
trackball_
.
mouse_release
(
button
,
x
,
y
);
glutPostRedisplay
();
}
//-----------------------------------------------------------------------------
void
GlutExaminer
::
motion
(
int
x
,
int
y
)
{
trackball_
.
mouse_move
(
x
,
y
);
glutPostRedisplay
();
}
//-----------------------------------------------------------------------------
void
GlutExaminer
::
keyboard
(
int
key
,
int
x
,
int
y
)
{
switch
(
key
)
{
case
'f'
:
{
std
::
cerr
<<
"Performance test: "
;
double
fps
=
measure_fps
();
std
::
cerr
<<
fps
<<
" FPS
\n
"
;
break
;
}
default:
{
GlutViewer
::
keyboard
(
key
,
x
,
y
);
break
;
}
}
}
//-----------------------------------------------------------------------------
void
GlutExaminer
::
setup_scene
(
const
Vec3f
&
_center
,
float
_radius
)
{
center_
=
_center
;
radius_
=
_radius
;
trackball_
.
set_center
(
_center
);
near_
=
0.01
f
*
radius_
;
far_
=
10.0
f
*
radius_
;
update_projection
();
view_all
();
}
//-----------------------------------------------------------------------------
void
GlutExaminer
::
view_all
()
{
ACG
::
Vec3d
t
=
(
-
(
glstate_
.
modelview
().
transform_point
(
center_
))
-
Vec3d
(
0.0
f
,
0.0
f
,
3.0
f
*
radius_
));
glstate_
.
translate
(
t
[
0
],
t
[
1
],
t
[
2
],
MULT_FROM_LEFT
);
}
//-----------------------------------------------------------------------------
double
GlutExaminer
::
measure_fps
()
{
const
Vec3d
t
=
glstate_
.
modelview
().
transform_point
(
center_
);
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
StopWatch
timer
;
timer
.
start
();
for
(
int
i
=
0
;
i
<
72
;
++
i
)
{
glstate_
.
translate
(
-
t
[
0
],
-
t
[
1
],
-
t
[
2
],
MULT_FROM_LEFT
);
glstate_
.
rotate
(
5.0
f
,
0.0
f
,
1.0
f
,
0.0
f
,
MULT_FROM_LEFT
);
glstate_
.
translate
(
t
[
0
],
t
[
1
],
t
[
2
],
MULT_FROM_LEFT
);
display
();
}
glFinish
();
double
elapsed
=
timer
.
stop
();
glPopMatrix
();
glutPostRedisplay
();
return
(
1000.0
/
elapsed
*
72.0
);
}
//=============================================================================
}
// namespace ACG
//=============================================================================
libs_required/ACG/Glut/GlutExaminer.hh
deleted
100644 → 0
View file @
b17ce782
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS GlutExaminer
//
//=============================================================================
#ifndef ACG_GLUTEXAMINER_HH
#define ACG_GLUTEXAMINER_HH
//== INCLUDES =================================================================
#include
"GlutViewer.hh"
#include
"../GL/GLTrackball.hh"
#include
"../Config/ACGDefines.hh"
//== NAMESPACES ===============================================================
namespace
ACG
{
//== CLASS DEFINITION =========================================================
class
ACGDLLEXPORT
GlutExaminer
:
public
GlutViewer
{
public:
GlutExaminer
(
const
char
*
_title
,
int
_width
,
int
_height
);
~
GlutExaminer
()
{}
void
setup_scene
(
const
Vec3f
&
_center
,
float
_radius
);
void
view_all
();
double
measure_fps
();
protected:
virtual
void
init
();
virtual
void
draw
();
virtual
void
motion
(
int
x
,
int
y
);
virtual
void
mouse
(
int
button
,
int
state
,
int
x
,
int
y
);
virtual
void
keyboard
(
int
key
,
int
x
,
int
y
);
protected:
GLTrackball
trackball_
;
Vec3d
center_
;
float
radius_
;
};
//=============================================================================
}
// namespace ACG
//=============================================================================
#endif // ACG_GLUTEXAMINER_HH defined
//=============================================================================
libs_required/ACG/Glut/GlutViewer.cc
deleted
100644 → 0
View file @
b17ce782
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS GlutViewer - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
#include
"GlutViewer.hh"
#include
<cstdio>
//== NAMESPACES ===============================================================
namespace
ACG
{
//== IMPLEMENTATION ==========================================================
std
::
map
<
int
,
GlutViewer
*>
GlutViewer
::
windows__
;
//-----------------------------------------------------------------------------
GlutViewer
::
GlutViewer
(
const
char
*
_title
,
int
_width
,
int
_height
)
:
width_
(
_width
),
height_
(
_height
),
fullscreen_
(
false
),
bak_left_
(
0
),
bak_top_
(
0
),
bak_width_
(
0
),
bak_height_
(
0
)
{
// create window
glutInitDisplayMode
(
GLUT_RGB
|
GLUT_DEPTH
|
GLUT_DOUBLE
|
GLUT_ALPHA
);
glutInitWindowSize
(
_width
,
_height
);
glViewport
(
0
,
0
,
_width
,
_height
);
windowID_
=
glutCreateWindow
(
_title
);
windows__
[
windowID_
]
=
this
;
// register callbacks
glutDisplayFunc
(
display__
);
glutKeyboardFunc
(
keyboard__
);
glutSpecialFunc
(
special__
);
glutMouseFunc
(
mouse__
);
glutMotionFunc
(
motion__
);
glutPassiveMotionFunc
(
passivemotion__
);
glutReshapeFunc
(
reshape__
);
glutVisibilityFunc
(
visibility__
);
// init GL
init
();
}
//-----------------------------------------------------------------------------
GlutViewer
::
~
GlutViewer
()
{
glutDestroyWindow
(
windowID_
);
}
//-----------------------------------------------------------------------------
void
GlutViewer
::
init
()
{
// init GL state
glstate_
.
initialize
();
// OpenGL state
ACG
::
GLState
::
enable
(
GL_DEPTH_TEST
);
ACG
::
GLState
::
enable
(
GL_LIGHTING
);
ACG
::
GLState
::
disable
(
GL_DITHER
);
ACG
::
GLState
::
shadeModel
(
GL_FLAT
);
glFrontFace
(
GL_CCW
);
// light sources
glLoadIdentity
();
GLfloat
pos
[
4
],
col
[
4
];
col
[
0
]
=
col
[
1
]
=
col
[
2
]
=
0.6
f
;
pos
[
3
]
=
0.0
f
;
col
[
3
]
=
1.0
f
;
#define SET_LIGHT(i,x,y,z) { \
pos[0]=x; pos[1]=y; pos[2]=z; \
glLightfv(GL_LIGHT##i, GL_POSITION, pos); \
glLightfv(GL_LIGHT##i, GL_DIFFUSE, col); \
glLightfv(GL_LIGHT##i, GL_SPECULAR, col); \
ACG::GLState::enable(GL_LIGHT##i); \
}
SET_LIGHT
(
0
,
0.0
f
,
0.0
f
,
1.0
f
);
SET_LIGHT
(
1
,
-
1.0
f
,
1.0
f
,
0.7
f
);
SET_LIGHT
(
2
,
1.0
f
,
1.0
f
,
0.7
f
);
// projection
near_
=
0.1
f
;
far_
=
100.0
f
;
fovy_
=
45.0
f
;
update_projection
();
glstate_
.
viewport
(
0
,
0
,
width_
,
height_
);
glstate_
.
translate
(
0
,
0
,
-
3
);
}
//-----------------------------------------------------------------------------
void
GlutViewer
::
update_projection
()
{
glstate_
.
reset_projection
();
glstate_
.
perspective
(
fovy_
,
(
GLfloat
)
width_
/
(
GLfloat
)
height_
,
near_
,
far_
);
}
//-----------------------------------------------------------------------------
GlutViewer
*
GlutViewer
::
current_window
()
{
return
windows__
[
glutGetWindow
()];
}
void
GlutViewer
::
display__
(
void
)
{
current_window
()
->
display
();
}
void
GlutViewer
::
idle__
(
void
)
{
current_window
()
->
idle
();
}
void
GlutViewer
::
keyboard__
(
unsigned
char
key
,
int
x
,
int
y
)
{
current_window
()
->
keyboard
((
int
)
key
,
x
,
y
);
}
void
GlutViewer
::
motion__
(
int
x
,
int
y
)
{
current_window
()
->
motion
(
x
,
y
);
}
void
GlutViewer
::
mouse__
(
int
button
,
int
state
,
int
x
,
int
y
)
{
current_window
()
->
mouse
(
button
,
state
,
x
,
y
);
}
void
GlutViewer
::
passivemotion__
(
int
x
,
int
y
)
{
current_window
()
->
passivemotion
(
x
,
y
);
}
void
GlutViewer
::
reshape__
(
int
w
,
int
h
)
{
current_window
()
->
reshape
(
w
,
h
);
}
void
GlutViewer
::
special__
(
int
key
,
int
x
,
int
y
)
{
current_window
()
->
keyboard
(
key
,
x
,
y
);
}
void
GlutViewer
::
visibility__
(
int
visible
)
{
current_window
()
->
visibility
(
visible
);
}
//-----------------------------------------------------------------------------
void
GlutViewer
::
idle
(
void
)
{
}
void
GlutViewer
::
keyboard
(
int
key
,
int
/* x */
,
int
/* y */
)
{
switch
(
key
)
{
case
27
:
{
exit
(
0
);
}
case
GLUT_KEY_F12
:
{
if
(
!
fullscreen_
)
{
bak_left_
=
glutGet
(
GLUT_WINDOW_X
);
bak_top_
=
glutGet
(
GLUT_WINDOW_Y
);
bak_width_
=
glutGet
(
GLUT_WINDOW_WIDTH
);
bak_height_
=
glutGet
(
GLUT_WINDOW_HEIGHT
);
glutFullScreen
();
fullscreen_
=
true
;
}
else
{
glutReshapeWindow
(
bak_width_
,
bak_height_
);
glutPositionWindow
(
bak_left_
,
bak_top_
);
fullscreen_
=
false
;
}
break
;
}
}
}
void
GlutViewer
::
motion
(
int
/* x */
,
int
/* y */
)
{
}
void
GlutViewer
::
mouse
(
int
/* button */
,
int
/* state */
,
int
/* x */
,
int
/* y */
)
{
}
void
GlutViewer
::
passivemotion
(
int
/* x */
,
int
/* y */
)
{
}
void
GlutViewer
::
visibility
(
int
/* visible */
)
{
}
void
GlutViewer
::
reshape
(
int
w
,
int
h
)
{
width_
=
w
;
height_
=
h
;
glstate_
.
viewport
(
0
,
0
,
width_
,
height_
);
glstate_
.
reset_projection
();
glstate_
.
perspective
(
fovy_
,
(
GLfloat
)
width_
/
(
GLfloat
)
height_
,
near_
,
far_
);
glutPostRedisplay
();
}
void
GlutViewer
::
display
(
void
)
{
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
draw
();
glutSwapBuffers
();
}
//=============================================================================
}
// namespace ACG
//=============================================================================
libs_required/ACG/Glut/GlutViewer.hh
deleted
100644 → 0
View file @
b17ce782