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, ChSystem *msystem)
 Initialize the window and set up the opengl viewer class. More...
 
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)
 

Static Public Member Functions

static ChOpenGLWindowgetInstance ()
 Get the unique instance for the OpenGL window. More...
 
static void GLFWGetVersion (GLFWwindow *main_window)
 Provides the version of the OpenGL context along with driver information. More...
 

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

◆ getInstance()

static ChOpenGLWindow& chrono::opengl::ChOpenGLWindow::getInstance ( )
inlinestatic

Get the unique instance for the OpenGL window.

Call this function to get a pointer to the window.

◆ GLFWGetVersion()

void chrono::opengl::ChOpenGLWindow::GLFWGetVersion ( GLFWwindow *  main_window)
static

Provides the version of the OpenGL context along with driver information.

Parameters
main_windowA pointer to the window/context

◆ Initialize()

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

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
msystemThe ChSystem that is attached to this window

◆ 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 
)
inline

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

◆ 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