CGPdocs

OpenGL, window and GUI helpers

OpenGL error checks and low-level buffers, ImGui frame functions, WebGL window helpers.

Compute 1

std::string opengl_info_display()

String describing the OpenGL vendor, renderer, version and GLSL version (returned, not printed).

Convert 1

std::string str(cache_uniform_location_structure const& cache)

String listing every cached (shader id, uniform name, location) entry.

I/O 1

GLuint opengl_load_texture_image(
    std::string const& filename,
    GLint wrap_s = GL_CLAMP_TO_EDGE,
    GLint wrap_t = GL_CLAMP_TO_EDGE
)

Load a PNG or JPEG file and upload it as a mipmapped 2D OpenGL texture, returning its id.

Access 1

void check_opengl_error(std::string const& file, std::string const& function, int line)

Drain the OpenGL error queue and raise a CGP error with the file, function and line if any error was pending; used by the opengl_check macro.

Other 7

void emscripten_set_glfw_window_hint()

Set the GLFW window hints for an OpenGL ES 3.0 context when compiled with Emscripten, do nothing otherwise.

void emscripten_update_window_size(int& width, int& height)

Set width and height to the HTML canvas size when compiled with Emscripten, do nothing otherwise.

void imgui_cleanup()

Shut down the ImGui OpenGL3 and GLFW backends and destroy the ImGui context.

void imgui_create_frame()

Start a new ImGui frame; call before any ImGui widget of the current frame.

void imgui_init(GLFWwindow* window)

Create the ImGui context and initialize its GLFW and OpenGL3 backends for the window (GLSL 150, or 300 es with Emscripten).

void imgui_render_frame(GLFWwindow* window)

Render the ImGui widgets of the current frame with OpenGL.

std::ostream& operator<<(std::ostream& s, cache_uniform_location_structure const& cache)

Write the content of the uniform location cache to the stream.

CGP - Computer Graphics Programming.