7 #define _USE_MATH_DEFINES 16 int main(
int argc,
char * argv[])
try 22 if(ctx.
get_device_count() == 0)
throw std::runtime_error(
"No device detected. Is it plugged in?");
27 std::ostringstream ss; ss <<
"CPP Restart Example (" << dev.
get_name() <<
")";
31 for(
int i=0; i<20; ++i)
37 std::this_thread::sleep_for(std::chrono::milliseconds(100));
39 for(
int j=0; j<4; ++j)
120 for(
int j=0; j<120; ++j)
130 glViewport(0, 0, w, h);
131 glClear(GL_COLOR_BUFFER_BIT);
136 glOrtho(0, w, h, 0, -1, +1);
148 std::cout <<
"Skipping mode " << i << std::endl;
161 catch(
const std::exception & e)
163 std::cerr << e.what() << std::endl;
void log_to_console(log_severity min_severity)
Provides convenience methods relating to devices.
void enable_stream(stream stream, int width, int height, format format, int framerate, output_buffer_format output_buffer_type=output_buffer_format::continous)
Enables specific stream and requests specific properties.
GLFWAPI void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the client area of the specified window.
const std::string & get_failed_args() const
Exposes librealsense functionality for C++ compilers.
GLfloat GLfloat GLfloat GLfloat h
struct GLFWwindow GLFWwindow
Opaque window object.
void stop(rs::source source=rs::source::video)
Ends streaming on all streams for this device.
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
void show(float rx, float ry, float rw, float rh) const
stream
Streams are different types of data provided by RealSense devices.
int main(int argc, char *argv[])
bool is_stream_enabled(stream stream) const
Determines if specific stream is enabled.
const char * get_name() const
Retrieves human-readable device model string.
void start(rs::source source=rs::source::video)
Begins streaming on all enabled streams for this device.
GLFWAPI void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
GLFWAPI GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
void disable_stream(stream stream)
Disables specific stream.
GLFWAPI void glfwDestroyWindow(GLFWwindow *window)
Destroys the specified window and its context.
GLFWAPI void glfwTerminate(void)
Terminates the GLFW library.
GLFWAPI void glfwPollEvents(void)
Processes all pending events.
bool is_streaming() const
Determines if device is currently streaming.
device * get_device(int index)
const std::string & get_failed_function() const
GLubyte GLubyte GLubyte GLubyte w
void wait_for_frames()
Blocks until new frames are available.
int get_device_count() const
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.