Easy3D 2.6.1
|
OpenGL-related functionalities for reading pixel/depth data from the framebuffer. More...
Functions | |
bool | check_gl_error (const std::string &file, const std::string &function, int line, std::ostream &os=std::cerr) |
Checks the last OpenGL error. | |
bool | check_frame_buffer_error (const std::string &file, const std::string &function, int line, std::ostream &os=std::cerr) |
Checks the last framebuffer error. | |
bool | gl_error (std::string &msg) |
Checks if there was an OpenGL error. If there was an error, the error message will be stored in "msg". | |
bool | frame_buffer_error (std::string &msg) |
Checks if there was a framebuffer error. If there was an error, the error message will be stored in "msg". | |
void | setup_gl_debug_callback () |
Set up a debug callback for OpenGL. | |
void | read_color (unsigned char rgba[4], int x, int y) |
Read color value at pixel (x, y) from the current non-multisample framebuffer. | |
void | read_color_ms (unsigned char rgba[4], int x, int y) |
Read color value at pixel (x, y) from the current multisample framebuffer. | |
void | read_depth (float &depth, int x, int y) |
Read depth value at pixel (x, y) from the current non-multisample framebuffer. | |
void | read_depth_ms (float &depth, int x, int y) |
Read depth value at pixel (x, y) from the current multisample framebuffer. | |
void | read_color (std::vector< unsigned char > &buffer, unsigned int format, bool flip_vertically=true) |
Read color data of the current non-multisample framebuffer into a specified buffer. | |
void | read_color_ms (std::vector< unsigned char > &buffer, unsigned int format, bool flip_vertically=true) |
Read color data of the current multisample framebuffer into a specified buffer. | |
void | snapshot_color (const std::string &file_name) |
Snapshot the color render buffer of the current non-multisample framebuffer into an image file. This is very useful for debugging. | |
void | snapshot_color_ms (const std::string &file_name) |
Snapshot the color render buffer of the current multisample framebuffer into an image file. This is very useful for debugging. | |
void | read_depth (std::vector< float > &buffer, bool flip_vertically=true) |
Read the depth data of the current non-multisample framebuffer into a specified buffer. | |
void | read_depth_ms (std::vector< float > &buffer, bool flip_vertically=true) |
Read the depth data of the current multisample framebuffer into a specified buffer. | |
void | snapshot_depth (const std::string &file_name) |
Snapshot the depth render buffer of the current non-multisample framebuffer into an image file. This is very useful for debugging. | |
void | snapshot_depth_ms (const std::string &file_name) |
Snapshot the depth render buffer of the current multisample framebuffer into an image file. This is very useful for debugging. | |
OpenGL-related functionalities for reading pixel/depth data from the framebuffer.
For multisample-version functions, a normal framebuffer is created for bliting color/depth from the multisample framebuffer object. For high-frequent queries, you'd better create a normal fbo for bliting operations. This way, you can avoid frequently allocating and deallocating GPU memories.
bool check_frame_buffer_error | ( | const std::string & | file, |
const std::string & | function, | ||
int | line, | ||
std::ostream & | os = std::cerr ) |
Checks the last framebuffer error.
file | The file name where the error occurred. |
function | The function name where the error occurred. |
line | The line number where the error occurred. |
os | The output stream to write the error message. Default is std::cerr. |
bool check_gl_error | ( | const std::string & | file, |
const std::string & | function, | ||
int | line, | ||
std::ostream & | os = std::cerr ) |
Checks the last OpenGL error.
file | The file name where the error occurred. |
function | The function name where the error occurred. |
line | The line number where the error occurred. |
os | The output stream to write the error message. Default is std::cerr. |
bool frame_buffer_error | ( | std::string & | msg | ) |
Checks if there was a framebuffer error. If there was an error, the error message will be stored in "msg".
msg | The error message. |
bool gl_error | ( | std::string & | msg | ) |
Checks if there was an OpenGL error. If there was an error, the error message will be stored in "msg".
msg | The error message. |
void read_color | ( | std::vector< unsigned char > & | buffer, |
unsigned int | format, | ||
bool | flip_vertically = true ) |
Read color data of the current non-multisample framebuffer into a specified buffer.
buffer | The buffer to store the color data. |
format | The format of the pixel data. Supported formats: GL_RGB, GL_BGR, GL_RGBA, and GL_BGRA. |
flip_vertically | Flip the image data vertically if it is true (default value). This is convenient for OpenGL applications where the first pixel in the output array is expected to be the bottom left corner of the image. |
void read_color | ( | unsigned char | rgba[4], |
int | x, | ||
int | y ) |
Read color value at pixel (x, y) from the current non-multisample framebuffer.
rgba | The color value. |
x | The x-coordinate of the pixel, represented in the OpenGL coordinate system. |
y | The y-coordinate of the pixel, represented in the OpenGL coordinate system. |
void read_color_ms | ( | std::vector< unsigned char > & | buffer, |
unsigned int | format, | ||
bool | flip_vertically = true ) |
Read color data of the current multisample framebuffer into a specified buffer.
buffer | The buffer to store the color data. |
format | The format of the pixel data. Supported formats: GL_RGB, GL_BGR, GL_RGBA, and GL_BGRA. |
flip_vertically | Flip the image data vertically if it is true (default value). This is convenient for OpenGL applications where the first pixel in the output array is expected to be the bottom left corner of the image. |
void read_color_ms | ( | unsigned char | rgba[4], |
int | x, | ||
int | y ) |
Read color value at pixel (x, y) from the current multisample framebuffer.
rgba | The color value. |
x | The x-coordinate of the pixel, represented in the OpenGL coordinate system. |
y | The y-coordinate of the pixel, represented in the OpenGL coordinate system. |
void read_depth | ( | float & | depth, |
int | x, | ||
int | y ) |
Read depth value at pixel (x, y) from the current non-multisample framebuffer.
depth | The depth value. |
x | The x-coordinate of the pixel, represented in the OpenGL coordinate system. |
y | The y-coordinate of the pixel, represented in the OpenGL coordinate system. |
void read_depth | ( | std::vector< float > & | buffer, |
bool | flip_vertically = true ) |
Read the depth data of the current non-multisample framebuffer into a specified buffer.
buffer | The buffer to store the depth data. |
flip_vertically | Flip the image data vertically if it is true (default value). This is convenient for OpenGL applications where the first pixel in the output array is expected to be the bottom left corner of the image. |
void read_depth_ms | ( | float & | depth, |
int | x, | ||
int | y ) |
Read depth value at pixel (x, y) from the current multisample framebuffer.
depth | The depth value. |
x | The x-coordinate of the pixel, represented in the OpenGL coordinate system. |
y | The y-coordinate of the pixel, represented in the OpenGL coordinate system. |
void read_depth_ms | ( | std::vector< float > & | buffer, |
bool | flip_vertically = true ) |
Read the depth data of the current multisample framebuffer into a specified buffer.
buffer | The buffer to store the depth data. |
flip_vertically | Flip the image data vertically if it is true (default value). This is convenient for OpenGL applications where the first pixel in the output array is expected to be the bottom left corner of the image. |
void setup_gl_debug_callback | ( | ) |
Set up a debug callback for OpenGL.
void snapshot_color | ( | const std::string & | file_name | ) |
Snapshot the color render buffer of the current non-multisample framebuffer into an image file. This is very useful for debugging.
file_name | The file name of the image file. Supported formats: png, jpg, bmp, tga, and ppm. File format is determined by the extension of the file name. |
void snapshot_color_ms | ( | const std::string & | file_name | ) |
Snapshot the color render buffer of the current multisample framebuffer into an image file. This is very useful for debugging.
file_name | The file name of the image file. Supported formats: png, jpg, bmp, tga, and ppm. File format is determined by the extension of the file name. |
void snapshot_depth | ( | const std::string & | file_name | ) |
Snapshot the depth render buffer of the current non-multisample framebuffer into an image file. This is very useful for debugging.
file_name | The file name of the image file. Supported formats: png, jpg, bmp, tga, and ppm. File format is determined by the extension of the file name. |
void snapshot_depth_ms | ( | const std::string & | file_name | ) |
Snapshot the depth render buffer of the current multisample framebuffer into an image file. This is very useful for debugging.
file_name | The file name of the image file. Supported formats: png, jpg, bmp, tga, and ppm. File format is determined by the extension of the file name. |