forked from IntelRealSense/realsense-ros
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d0a77c
commit 35d1845
Showing
6 changed files
with
111 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2015 Intel Corporation. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API | ||
|
||
#define GL_SILENCE_DEPRECATION | ||
#define GLFW_INCLUDE_GLU | ||
#include <GLFW/glfw3.h> | ||
#include <GL/gl.h> | ||
#include <iostream> | ||
|
||
#include <librealsense2-gl/rs_processing_gl.hpp> // Include GPU-Processing API | ||
|
||
|
||
#ifndef PI | ||
#define PI 3.14159265358979323846 | ||
#define PI_FL 3.141592f | ||
#endif | ||
|
||
|
||
class window | ||
{ | ||
public: | ||
|
||
window(int width, int height, const char* title) | ||
: _width(width), _height(height) | ||
{ | ||
glfwInit(); | ||
win = glfwCreateWindow(width, height, title, nullptr, nullptr); | ||
if (!win) | ||
throw std::runtime_error("Could not open OpenGL window, please check your graphic drivers or use the textual SDK tools"); | ||
glfwMakeContextCurrent(win); | ||
|
||
glfwSetWindowUserPointer(win, this); | ||
|
||
} | ||
|
||
~window() | ||
{ | ||
glfwDestroyWindow(win); | ||
glfwTerminate(); | ||
} | ||
|
||
void close() | ||
{ | ||
glfwSetWindowShouldClose(win, 1); | ||
} | ||
|
||
float width() const { return float(_width); } | ||
float height() const { return float(_height); } | ||
|
||
operator bool() | ||
{ | ||
auto res = !glfwWindowShouldClose(win); | ||
|
||
glfwPollEvents(); | ||
|
||
return res; | ||
} | ||
|
||
operator GLFWwindow* () { return win; } | ||
|
||
private: | ||
GLFWwindow* win; | ||
int _width, _height; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters