Description

Manager for the OpenGL context and window.

#include <ChOpenGLWindow.h>

Collaboration diagram for chrono::opengl::ChOpenGLWindow:

Public Member Functions

void Initialize (int size_x, int size_y, const char *title)
 Initialize the window and set up the OpenGL viewer class. More...
 
void AttachSystem (ChSystem *system)
 Attach a Chrono system to the run-time visualization system.
 
void SetUserEventReceiver (ChOpenGLEventCB *receiver)
 Attach a custom event receiver to the OpenGL window.
 
void StartDrawLoop (double time_step)
 This starts the drawing loop and takes control away from the main program. More...
 
bool DoStepDynamics (double time_step)
 Perform a dynamics step, the user needs to use this so that pausing the simulation works correctly. More...
 
void EnableHUD (bool state)
 Enable/disable HUD display (default: true).
 
void Render ()
 Render the ChSystem and the HUD.
 
bool Active ()
 Check if the GLFW context is still valid and the window has not been closed.
 
bool Running ()
 Check if the simulation is running or paused.
 
void Pause ()
 Pause simulation.
 
void SetCamera (ChVector<> pos, ChVector<> look, ChVector<> up, float scale=0.5f, float near_clip_dist=0.1f, float far_clip_dist=1000.0f)
 Set the camera position, look at and up vectors. More...
 
void SetRenderMode (RenderMode mode)
 
void SetParticleRenderMode (float radius, RenderMode mode)
 

Static Public Member Functions

static ChOpenGLWindowgetInstance ()
 Get the unique instance for the OpenGL window.
 
static void GLFWGetVersion (GLFWwindow *main_window)
 Provides the version of the OpenGL context along with driver information.
 
static void WrapRenderStep (void *stepFunction)
 Callback wrapper for steps of the render loop. Works with Emscripten.
 

Public Attributes

ChOpenGLViewerviewer
 Pointer to the opengl viewer that handles rendering, text and user interaction.
 

Member Function Documentation

◆ DoStepDynamics()

bool chrono::opengl::ChOpenGLWindow::DoStepDynamics ( double  time_step)

Perform a dynamics step, the user needs to use this so that pausing the simulation works correctly.

Parameters
time_stepintegration step size

◆ Initialize()

void chrono::opengl::ChOpenGLWindow::Initialize ( int  size_x,
int  size_y,
const char *  title 
)

Initialize the window and set up the OpenGL viewer class.

Parameters
size_xWidth of window in pixels
size_yHeight of window in pixels
titleWindow title string

◆ SetCamera()

void chrono::opengl::ChOpenGLWindow::SetCamera ( ChVector<>  pos,
ChVector<>  look,
ChVector<>  up,
float  scale = 0.5f,
float  near_clip_dist = 0.1f,
float  far_clip_dist = 1000.0f 
)

Set the camera position, look at and up vectors.

Parameters
posThe position of the camera
lookThe point that the camera is looking at
upThe up vector associated with the camera
scalezoom level
near_clip_distnear clipping distance
far_clip_distfar clipping distance

◆ StartDrawLoop()

void chrono::opengl::ChOpenGLWindow::StartDrawLoop ( double  time_step)

This starts the drawing loop and takes control away from the main program.

This function is the easiest way to start rendering.

Parameters
time_stepintegration step size

The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_opengl/ChOpenGLWindow.h
  • /builds/uwsbel/chrono/src/chrono_opengl/ChOpenGLWindow.cpp