PeriDyno 1.2.1
Loading...
Searching...
No Matches
GlfwApp.cpp
Go to the documentation of this file.
1#include "GlfwApp.h"
2
3namespace dyno
4{
5 GlfwApp::GlfwApp(int argc /*= 0*/, char **argv /*= NULL*/)
6 : AppBase()
7 {
8 //A hack to address the slow launching problem
9#ifdef CUDA_BACKEND
10 auto status = cudaSetDevice(0);
11 if (status != cudaSuccess) {
12 fprintf(stderr, "CUDA initialization failed! Do you have a CUDA-capable GPU installed?");
13 exit(0);
14 }
15 cudaFree(0);
16#endif // CUDA_BACKEND
17 }
18
20 {
21 }
22
23 void GlfwApp::initialize(int width, int height, bool usePlugin)
24 {
25 mRenderWindow = std::make_shared<GlfwRenderWindow>();
26
27 mRenderWindow->initialize(width, height);
28 }
29
31 {
32 mRenderWindow->mainLoop();
33 }
34
35 void GlfwApp::setWindowTitle(const std::string& title)
36 {
37 mRenderWindow->setWindowTitle(title);
38 }
39
40}
void setWindowTitle(const std::string &title)
Definition GlfwApp.cpp:35
void initialize(int width, int height, bool usePlugin=false) override
Definition GlfwApp.cpp:23
void mainLoop() override
Definition GlfwApp.cpp:30
GlfwApp(int argc=0, char **argv=NULL)
Definition GlfwApp.cpp:5
std::shared_ptr< GlfwRenderWindow > mRenderWindow
Definition GlfwApp.h:27
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25