Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Classes | Typedefs | Enumerations | Functions
rs_processing_gl.h File Reference

Exposes RealSense processing-block functionality for GPU for C compilers. More...

#include "librealsense2/rs.h"

Go to the source code of this file.

Classes

struct  glfw_binding
 

Typedefs

typedef enum rs2_gl_extension rs2_gl_extension
 
typedef enum rs2_gl_matrix_type rs2_gl_matrix_type
 
typedef struct GLFWwindow GLFWwindow
 
typedef struct GLFWmonitor GLFWmonitor
 
typedef int(* glfwInitFun) (void)
 
typedef void(* glfwWindowHintFun) (int, int)
 
typedef GLFWwindow *(* glfwCreateWindowFun) (int, int, const char *, GLFWmonitor *, GLFWwindow *)
 
typedef void(* glfwDestroyWindowFun) (GLFWwindow *)
 
typedef void(* glfwMakeContextCurrentFun) (GLFWwindow *)
 
typedef GLFWwindow *(* glfwGetCurrentContextFun) (void)
 
typedef void(* glfwSwapIntervalFun) (int)
 
typedef void(* GLFWglproc) (void)
 
typedef GLFWglproc(* glfwGetProcAddressFun) (const char *)
 

Enumerations

enum  rs2_gl_extension { RS2_GL_EXTENSION_VIDEO_FRAME, RS2_GL_EXTENSION_COUNT }
 
enum  rs2_gl_matrix_type { RS2_GL_MATRIX_TRANSFORMATION, RS2_GL_MATRIX_PROJECTION, RS2_GL_MATRIX_CAMERA, RS2_GL_MATRIX_COUNT }
 

Functions

const char * rs2_gl_extension_to_string (rs2_extension type)
 
const char * rs2_gl_matrix_type_to_string (rs2_gl_matrix_type type)
 
rs2_processing_blockrs2_gl_create_yuy_decoder (int api_version, rs2_error **error)
 
rs2_processing_blockrs2_gl_create_y411_decoder (int api_version, rs2_error **error)
 
void rs2_gl_set_matrix (rs2_processing_block *block, rs2_gl_matrix_type type, float *m4x4, rs2_error **error)
 
int rs2_gl_is_frame_extendable_to (const rs2_frame *f, rs2_gl_extension extension_type, rs2_error **error)
 
unsigned int rs2_gl_frame_get_texture_id (const rs2_frame *f, unsigned int id, rs2_error **error)
 
rs2_processing_blockrs2_gl_create_camera_renderer (int api_version, rs2_error **error)
 
rs2_processing_blockrs2_gl_create_pointcloud_renderer (int api_version, rs2_error **error)
 
rs2_processing_blockrs2_gl_create_pointcloud (int api_version, rs2_error **error)
 
rs2_processing_blockrs2_gl_create_uploader (int api_version, rs2_error **error)
 
rs2_processing_blockrs2_gl_create_colorizer (int api_version, rs2_error **error)
 
rs2_processing_blockrs2_gl_create_align (int api_version, rs2_stream to, rs2_error **error)
 
void rs2_gl_init_rendering (int api_version, int use_glsl, rs2_error **error)
 
void rs2_gl_init_rendering_glfw (int api_version, glfw_binding bindings, int use_glsl, rs2_error **error)
 
void rs2_gl_init_processing (int api_version, int use_glsl, rs2_error **error)
 
void rs2_gl_init_processing_glfw (int api_version, GLFWwindow *share_with, glfw_binding bindings, int use_glsl, rs2_error **error)
 
void rs2_gl_shutdown_rendering (int api_version, rs2_error **error)
 
void rs2_gl_shutdown_processing (int api_version, rs2_error **error)
 

Detailed Description

Exposes RealSense processing-block functionality for GPU for C compilers.

Typedef Documentation

◆ glfwCreateWindowFun

typedef GLFWwindow*(* glfwCreateWindowFun) (int, int, const char *, GLFWmonitor *, GLFWwindow *)

◆ glfwDestroyWindowFun

typedef void(* glfwDestroyWindowFun) (GLFWwindow *)

◆ glfwGetCurrentContextFun

typedef GLFWwindow*(* glfwGetCurrentContextFun) (void)

◆ glfwGetProcAddressFun

typedef GLFWglproc(* glfwGetProcAddressFun) (const char *)

◆ GLFWglproc

typedef void(* GLFWglproc) (void)

◆ glfwInitFun

typedef int(* glfwInitFun) (void)

◆ glfwMakeContextCurrentFun

typedef void(* glfwMakeContextCurrentFun) (GLFWwindow *)

◆ GLFWmonitor

typedef struct GLFWmonitor GLFWmonitor

◆ glfwSwapIntervalFun

typedef void(* glfwSwapIntervalFun) (int)

◆ GLFWwindow

typedef struct GLFWwindow GLFWwindow

◆ glfwWindowHintFun

typedef void(* glfwWindowHintFun) (int, int)

◆ rs2_gl_extension

◆ rs2_gl_matrix_type

Enumeration Type Documentation

◆ rs2_gl_extension

Enumerator
RS2_GL_EXTENSION_VIDEO_FRAME 
RS2_GL_EXTENSION_COUNT 

◆ rs2_gl_matrix_type

Enumerator
RS2_GL_MATRIX_TRANSFORMATION 
RS2_GL_MATRIX_PROJECTION 
RS2_GL_MATRIX_CAMERA 
RS2_GL_MATRIX_COUNT 

Function Documentation

◆ rs2_gl_create_align()

rs2_processing_block* rs2_gl_create_align ( int  api_version,
rs2_stream  to,
rs2_error **  error 
)

Creates Align processing block This block has similar capabilities as the regular librealsense align

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[in]align_tostream type to be used as the target of frameset alignment
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_create_camera_renderer()

rs2_processing_block* rs2_gl_create_camera_renderer ( int  api_version,
rs2_error **  error 
)

Camera renderer is a rendering block (meaning it has to be called within the main OpenGL rendering context) that will render the camera model of the frame provided to it

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_create_colorizer()

rs2_processing_block* rs2_gl_create_colorizer ( int  api_version,
rs2_error **  error 
)

Creates Colorizer processing block This block has similar capabilities as the regular librealsense colorizer It is capable of applying depth to RGB conversion using various color schemes and optional histogram equalization

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_create_pointcloud()

rs2_processing_block* rs2_gl_create_pointcloud ( int  api_version,
rs2_error **  error 
)

Creates Point-Cloud processing block. This block accepts depth frames and outputs Points frames In addition, given non-depth frame, the block will align texture coordinate to the non-depth stream

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_create_pointcloud_renderer()

rs2_processing_block* rs2_gl_create_pointcloud_renderer ( int  api_version,
rs2_error **  error 
)

Pointcloud renderer will render texture pointcloud as either points or connected polygons

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_create_uploader()

rs2_processing_block* rs2_gl_create_uploader ( int  api_version,
rs2_error **  error 
)

Creates Upload processing block This object can explicitly copy frames from the CPU to the GPU This allows pre-emptively upload frame to the GPU on a background thread To be used directly in future GPU processing

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_create_y411_decoder()

rs2_processing_block* rs2_gl_create_y411_decoder ( int  api_version,
rs2_error **  error 
)

Creates y411 decoder processing block. This block accepts raw y411 frames and outputs frames in RGB8. https://www.fourcc.org/pixel-format/yuv-y411/ Y411 is disguised as NV12 to allow Linux compatibility. Both are 12bpp encodings that allow high-resolution modes in the camera to still fit within the USB3 limits (YUY wasn't enough).

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_create_yuy_decoder()

rs2_processing_block* rs2_gl_create_yuy_decoder ( int  api_version,
rs2_error **  error 
)

Creates a processing block that can efficiently convert YUY image format to RGB variants This is specifically useful for rendering the RGB frame to the screen (since the output is ready for rendering on the GPU)

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_extension_to_string()

const char* rs2_gl_extension_to_string ( rs2_extension  type)

◆ rs2_gl_frame_get_texture_id()

unsigned int rs2_gl_frame_get_texture_id ( const rs2_frame f,
unsigned int  id,
rs2_error **  error 
)

Assuming frame is extendable to RS2_GL_EXTENSION_VIDEO_FRAME, this method will fetch one of frames texture IDs Each GPU frame can hold one or more OpenGL textures

Parameters
[in]fFrame pointer
[in]idIndex of texture within the frame
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
OpenGL texture

◆ rs2_gl_init_processing()

void rs2_gl_init_processing ( int  api_version,
int  use_glsl,
rs2_error **  error 
)

Initialize processing pipeline. This function allows GL processing blocks to run on the GPU. Until initialized, all GL processing blocks will fall back to their CPU versions. When initializing using this method, texture sharing is not available.

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_init_processing_glfw()

void rs2_gl_init_processing_glfw ( int  api_version,
GLFWwindow share_with,
glfw_binding  bindings,
int  use_glsl,
rs2_error **  error 
)

In order to share GL processing results with GLFW rendering application the user need to initialize rendering by passing GLFW binding information C++ wrapper will automatically generate and pass this data

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[in]share_withPointer to GLFW window object. This window will be able to use texture IDs provided inside GPU-frames generated by the library
[in]bindingsPointers to GLFW methods that will be used by the library
[in]use_glslUse GLSL shaders for processing
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_init_rendering()

void rs2_gl_init_rendering ( int  api_version,
int  use_glsl,
rs2_error **  error 
)

Initialize rendering pipeline. This function must be called before executing any of the rendering blocks. Rendering blocks do not handle threading, and assume all calls (including init / shutdown) Until initialized, rendering blocks will do nothing (function as bypass filters) are serialized and coming from a single rendering thread

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[in]use_glslOn modern GPUs you can get slightly better performance using GLSL However, this assumes the current rendering context is v3+ Setting use_glsl to false will use legacy OpenGL calls This in turn assumes the rendering context is either version < 3, or is a compatibility context
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_init_rendering_glfw()

void rs2_gl_init_rendering_glfw ( int  api_version,
glfw_binding  bindings,
int  use_glsl,
rs2_error **  error 
)

In order to use GL rendering with GLFW application the user need to initialize rendering by passing GLFW binding information C++ wrapper will automatically generate and pass this data

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[in]bindingsPointers to GLFW methods that will be used by the library
[in]use_glslUse GLSL shaders for rendering
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_is_frame_extendable_to()

int rs2_gl_is_frame_extendable_to ( const rs2_frame f,
rs2_gl_extension  extension_type,
rs2_error **  error 
)

Query if frame is extendable to one of the GL-specific extensions

Parameters
[in]fFrame pointer
[in]extension_typeExtension type
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
1 if true, 0 otherwise

◆ rs2_gl_matrix_type_to_string()

const char* rs2_gl_matrix_type_to_string ( rs2_gl_matrix_type  type)

◆ rs2_gl_set_matrix()

void rs2_gl_set_matrix ( rs2_processing_block block,
rs2_gl_matrix_type  type,
float *  m4x4,
rs2_error **  error 
)

Sets new value to one of processing blocks matrices

Parameters
[in]blockProcessing block object
[in]typeMatrix type
[in]m4x4Pointer to 16 floating point values encoding 4x4 matrix
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_shutdown_processing()

void rs2_gl_shutdown_processing ( int  api_version,
rs2_error **  error 
)

Shutdown librealsense processing. This will switch all GL processing blocks into CPU only mode

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_gl_shutdown_rendering()

void rs2_gl_shutdown_rendering ( int  api_version,
rs2_error **  error 
)

Shutdown librealsense rendering. This will disable all rendering blocks

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored