CGVIS Utils
Loading...
Searching...
No Matches
GLEnv.h File Reference

Cross‑platform OpenGL window/context helper for desktop and Emscripten. More...

#include <memory>
#include <string>
#include <chrono>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "GLDebug.h"
Include dependency graph for GLEnv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GLEnv
 Window/context manager for OpenGL (GLFW+GLEW) or WebGL (Emscripten). More...

Enumerations

enum class  GLDataType { BYTE , HALF , FLOAT }
 Element type selector for texture uploads/allocations. More...
enum class  GLDepthDataType { DEPTH16 , DEPTH24 , DEPTH32 }
 Depth storage selection for depth textures. More...
enum class  CursorMode { NORMAL , HIDDEN , FIXED }
 Mouse cursor behavior modes. More...

Detailed Description

Cross‑platform OpenGL window/context helper for desktop and Emscripten.

Provides a minimal environment wrapper that creates and manages an OpenGL context and window/canvas, exposes dimensions, vsync, FPS counter, and basic input callback wiring. On desktop it uses GLFW (+**GLEW** initialization); on the web it uses Emscripten WebGL APIs.

Key features:

  • Creation of an OpenGL (or WebGL) context with configurable version and profile (GLEnv::GLEnv).
  • Event callback registration for keyboard, mouse, and resize.
  • Frame lifecycle utilities: endOfFrame() swaps buffers/polls events and updates an optional FPS counter in the window title.
  • Dimension queries (getFramebufferSize(), getWindowSize()).
  • VSync control (setSync(), getSync()).
  • Simple cursor mode handling via setCursorMode().

All GL error handling uses the utilities declared in GLDebug.h.

Enumeration Type Documentation

◆ CursorMode

enum class CursorMode
strong

Mouse cursor behavior modes.

Enumerator
NORMAL 
HIDDEN 
FIXED 

◆ GLDataType

enum class GLDataType
strong

Element type selector for texture uploads/allocations.

Enumerator
BYTE 
HALF 
FLOAT 

◆ GLDepthDataType

enum class GLDepthDataType
strong

Depth storage selection for depth textures.

Enumerator
DEPTH16 
DEPTH24 
DEPTH32