27#ifndef EASY3D_RENDERER_OPENGL_UTIL_H
28#define EASY3D_RENDERER_OPENGL_UTIL_H
32#include <unordered_map>
45 static bool is_initialized();
52 static bool is_supported(
const std::string &name);
53 static bool has_extension(
const std::string &name);
55 static std::string glew_version();
57 static std::string gl_vendor();
59 static std::string gl_renderer();
61 static std::string gl_version();
63 static std::string gl_extensions();
65 static std::string glsl_version();
67 static int gl_major_version();
69 static int gl_minor_version();
71 static float glew_version_number();
73 static float gl_version_number();
75 static float glsl_version_number();
82 static void viewport(
int &x,
int &y,
int &width,
int &height);
92 static int available_gpu_memory();
123 static void get_uniform_info(
unsigned int program,
const std::string &uniName);
131 static void _add_message(std::string format, ...);
135 static int _get_rows(
unsigned int type);
137 static int _get_columns(
unsigned int type);
139 static void _display_uniformf(
float *f,
int rows,
int columns);
141 static void _display_uniformi(
int *f,
int rows,
int columns);
143 static void _display_uniformui(
unsigned int *f,
int rows,
int columns);
145 static void _display_uniformd(
double *f,
int rows,
int columns);
147 static int _get_uniform_byte_size(
int size,
int uniType,
int arrayStride,
int matStride);
150 DONT_KNOW, INT, UNSIGNED_INT, FLOAT, DOUBLE
153 static Types _get_type(
unsigned int type);
156 static bool _glew_initialized;
160 static std::ostream *_output_stream;
162 static std::unordered_map<int, std::string> spBufferAccess;
163 static std::unordered_map<int, std::string> spBufferUsage;
164 static std::unordered_map<int, std::string> spBufferBinding;
165 static std::unordered_map<int, int> spBufferBound;
166 static std::unordered_map<int, int> spBoundBuffer;
167 static std::unordered_map<int, std::string> spDataF;
168 static std::unordered_map<int, std::string> spGLSLType;
169 static std::unordered_map<int, int> spGLSLTypeSize;
170 static std::unordered_map<int, std::string> spShaderType;
171 static std::unordered_map<int, std::string> spTransFeedBufferMode;
172 static std::unordered_map<int, std::string> spGLSLPrimitives;
173 static std::unordered_map<int, std::string> spTessGenSpacing;
174 static std::unordered_map<int, std::string> spVertexOrder;
Utilities for OpenGL initialization and states query.
Definition: opengl_util.h:41
static void get_uniform_in_block_info(unsigned int program, const std::string &blockName, const std::string &uniName)
display the values for a uniform in a named block
Definition: opengl_util.cpp:590
static void get_vao_info(unsigned int buffer)
display VAO information, including its attributes
Definition: opengl_util.cpp:351
static void set_output(std::ostream *out)
Definition: opengl_util.cpp:260
static void get_uniform_info(unsigned int program, const std::string &uniName)
display a uniform's value(s)
Definition: opengl_util.cpp:543
static int total_gpu_memory()
Definition: opengl_util.cpp:232
static void get_program_info(unsigned int program)
display detailed info for a program
Definition: opengl_util.cpp:689
static void viewport(int &x, int &y, int &width, int &height)
Definition: opengl_util.cpp:222
static void get_current_buffer_info()
display current bound buffer info
Definition: opengl_util.cpp:288
static int gl_profile()
returns either GL_CONTEXT_CORE_PROFILE_BIT or GL_CONTEXT_COMPATIBILITY_PROFILE_BIT
Definition: opengl_util.cpp:91
static void get_attributes_info(unsigned int program)
display detailed info for attributes in a program
Definition: opengl_util.cpp:660
static void get_uniforms_info(unsigned int program)
display info for all active uniforms in a program
Definition: opengl_util.cpp:414
static void get_buffer_info(unsigned int target, int bufferName)
display the buffer information
Definition: opengl_util.cpp:322
Definition: collider.cpp:182