Commit 0e4dbe3d authored by Nicolas Van der Noot's avatar Nicolas Van der Noot
Browse files

openGL working when sdl deactivated

parent b5c23a8c
......@@ -84,6 +84,7 @@
*/
void user_realtime_options(MbsData* mbs_data, Realtime_option *options)
{
options->flag_plot = 0;
}
......
......@@ -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
......@@ -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
}
......
......@@ -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
}
}
......
......@@ -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
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment