8#include <emscripten/emscripten.h>
9#include <emscripten/html5.h>
13#include <GLFW/glfw3.h>
78 GLEnv(uint32_t w, uint32_t h, uint32_t s,
const std::string& title,
bool fpsCounter=
false,
bool sync=
true,
int major=2,
int minor=1,
bool core=
false);
87 em_mouse_callback_func b,
88 em_mouse_callback_func bu,
89 em_mouse_callback_func bd,
90 em_wheel_callback_func s,
100 void setMouseCallbacks(GLFWcursorposfun p, GLFWmousebuttonfun b, GLFWscrollfun s);
146 void setTitle(
const std::string& title);
149#ifndef __EMSCRIPTEN__
155 std::chrono::high_resolution_clock::time_point last;
159 static void errorCallback(
int error,
const char* description);
Minimal OpenGL error utilities, exception type, and a debug GL() wrapper macro.
GLDataType
Element type selector for texture uploads/allocations.
Definition GLEnv.h:43
@ HALF
Definition GLEnv.h:43
@ BYTE
Definition GLEnv.h:43
@ FLOAT
Definition GLEnv.h:43
CursorMode
Mouse cursor behavior modes.
Definition GLEnv.h:53
@ NORMAL
Definition GLEnv.h:53
@ HIDDEN
Definition GLEnv.h:53
@ FIXED
Definition GLEnv.h:53
GLDepthDataType
Depth storage selection for depth textures.
Definition GLEnv.h:48
@ DEPTH24
Definition GLEnv.h:48
@ DEPTH16
Definition GLEnv.h:48
@ DEPTH32
Definition GLEnv.h:48
void setKeyCallbacks(GLFWkeyfun f, GLFWcharfun c)
Set key + char callbacks for GLFW builds.
Definition GLEnv.cpp:194
GLEnv(uint32_t w, uint32_t h, uint32_t s, const std::string &title, bool fpsCounter=false, bool sync=true, int major=2, int minor=1, bool core=false)
Construct a GL environment and create a window/canvas + context.
Definition GLEnv.cpp:44
static void checkGLError(const std::string &id)
Convenience GL error check, logs to stderr with an identifier.
Definition GLEnv.cpp:29
void setFPSCounter(bool fpsCounter)
Enable/disable FPS title updates.
Definition GLEnv.cpp:134
void endOfFrame()
End‑of‑frame housekeeping: swap/poll + optional FPS title update.
Definition GLEnv.cpp:138
void setResizeCallback(GLFWframebuffersizefun f)
Set framebuffer resize callback for GLFW builds.
Definition GLEnv.cpp:199
void setCursorMode(CursorMode mode)
Set mouse cursor behavior.
Definition GLEnv.cpp:249
Dimensions getFramebufferSize() const
Get framebuffer size in texels/pixels.
Definition GLEnv.cpp:210
Dimensions getWindowSize() const
Get logical window size.
Definition GLEnv.cpp:221
bool getSync() const
Current vsync state.
Definition GLEnv.h:137
~GLEnv()
Destroy window/context (desktop) or release resources (web).
Definition GLEnv.cpp:109
void setMouseCallbacks(GLFWcursorposfun p, GLFWmousebuttonfun b, GLFWscrollfun s)
Set mouse position/button/scroll callbacks for GLFW builds.
Definition GLEnv.cpp:203
void setKeyCallback(GLFWkeyfun f)
Set key callback for GLFW builds.
Definition GLEnv.cpp:190
void setClose()
Request closing the window (desktop only; no‑op on web).
Definition GLEnv.cpp:239
bool shouldClose() const
Query whether the window should close (desktop always; web always false).
Definition GLEnv.cpp:231
void setTitle(const std::string &title)
Set the window/page title (stored; displayed on next FPS refresh).
Definition GLEnv.cpp:245
void setSync(bool sync)
Enable/disable vsync.
Definition GLEnv.cpp:116
Simple pixel/viewport dimensions with an aspect ratio helper.
Definition GLDebug.h:45