Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
robotran
mbsysc
Commits
0e4dbe3d
Commit
0e4dbe3d
authored
Oct 13, 2016
by
Nicolas Van der Noot
Browse files
openGL working when sdl deactivated
parent
b5c23a8c
Changes
5
Hide whitespace changes
Inline
Side-by-side
ExampleProjects/PendulumSpringC/userfctR/realtime/user_realtime_options.c
View file @
0e4dbe3d
...
...
@@ -84,6 +84,7 @@
*/
void
user_realtime_options
(
MbsData
*
mbs_data
,
Realtime_option
*
options
)
{
options
->
flag_plot
=
0
;
}
...
...
MBsysC/mbs_common/mbs_realtime/open_gl/interface/open_gl_c_int.cc
View file @
0e4dbe3d
...
...
@@ -2,6 +2,7 @@
#include "open_gl_c_int.h"
#include "MbsWorld3D.hh"
#include "user_realtime.h"
/*! \brief initialize the OpenGL class
*
...
...
@@ -36,4 +37,55 @@ void free_open_gl(void *visu_class)
delete
static_cast
<
OpenGLMbs
::
MbsWorld3D
*>
(
visu_class
);
}
/*! \brief update the OpenGL visualization
*
* \param[in,out] realtime real-time structure
*/
void
update_open_gl
(
Simu_realtime
*
realtime
)
{
Realtime_visu
*
visu
;
MbsData
*
mbs_data
;
OpenGLMbs
::
MbsWorld3D
*
world_3d
;
// get fields
visu
=
realtime
->
ext
->
visu
;
mbs_data
=
realtime
->
ext
->
mbs_data
;
world_3d
=
static_cast
<
OpenGLMbs
::
MbsWorld3D
*>
(
visu
->
visu_class
);
// update world 3D timing
world_3d
->
UpdateTime
();
// update joint positions
user_realtime_visu
(
mbs_data
,
visu
->
nb_models
,
visu
->
nb_q
,
visu
->
cur_q
);
if
(
visu
->
visu_past_flag
)
{
visu
->
visu_past_flag
=
0
;
visu
->
last_past_q_flag
=
1
;
world_3d
->
UpdateJoints
(
visu
->
nb_q
[
0
],
visu
->
past_q
[
0
]);
}
else
if
(
visu
->
change_viewpoint
)
{
if
(
visu
->
last_past_q_flag
)
{
world_3d
->
UpdateJoints
(
visu
->
nb_q
[
0
],
visu
->
past_q
[
0
]);
}
else
{
world_3d
->
UpdateJoints
(
visu
->
nb_q
[
0
],
visu
->
cur_q
[
0
]);
}
}
else
{
visu
->
last_past_q_flag
=
0
;
world_3d
->
UpdateJoints
(
visu
->
nb_q
[
0
],
visu
->
cur_q
[
0
]);
}
// update the window
world_3d
->
Update
();
}
#endif
MBsysC/mbs_common/mbs_realtime/open_gl/interface/open_gl_c_int.h
View file @
0e4dbe3d
...
...
@@ -16,6 +16,7 @@ extern "C" {
void
init_open_gl
(
Realtime_visu
*
visu
,
int
nb_models
,
int
*
nb_q
,
double
**
q_vec
,
char
**
mbs_file
,
int
start_viewpoint
);
void
free_open_gl
(
void
*
visu_class
);
void
update_open_gl
(
Simu_realtime
*
realtime
);
#ifdef __cplusplus
}
...
...
MBsysC/mbs_common/mbs_realtime/realtime/realtime.c
View file @
0e4dbe3d
...
...
@@ -180,7 +180,7 @@ void mbs_realtime_loop(Simu_realtime *realtime, double tsim)
#if (defined JAVA)
update_java
(
realtime
);
#elif (defined OPEN_GL)
update_open_gl
(
realtime
);
#endif
}
}
...
...
MBsysC/mbs_common/mbs_realtime/sdl/plot_sdl.c
View file @
0e4dbe3d
...
...
@@ -3016,7 +3016,7 @@ void break_gestion(Simu_realtime *realtime, double tsim)
#if (defined JAVA)
update_java
(
realtime
);
#elif (defined OPEN_GL)
update_open_gl
(
realtime
);
#endif
}
}
...
...
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