Should You Use Raw WebGL or an Engine?
The Case for Raw WebGL
Raw WebGL development means writing directly against the WebGL API without a rendering engine or game framework. You create your own shader programs, manage your own buffers and textures, build your own render loop, and implement every feature from scratch. This approach is demanding, but it offers advantages that no engine can match in specific situations.
Total performance control is the primary advantage. When you write raw WebGL, you know exactly what every GPU cycle is doing. There is no engine overhead, no hidden allocations, no abstraction layers between your code and the hardware. You choose the draw call order, the buffer layout, the shader complexity, and the state management strategy. For games that push the limits of what a browser can render, such as massive multiplayer maps, complex particle simulations, or high-fidelity 3D scenes on mobile, this level of control can be the difference between hitting your target frame rate and missing it.
Minimal file size is the second major advantage. A raw WebGL game can ship in under 50KB of total JavaScript, including the game logic, shaders, and a simple asset loader. The smallest viable WebGL application is a few hundred bytes. Compare this to engine sizes: Phaser adds 200-400KB, Three.js adds 150-600KB, Babylon.js adds 500KB-1.5MB, and Unity's WebAssembly runtime starts at 5MB+. For games that must load instantly, such as playable advertisements, banner games, game jam entries optimized for size, or interactive easter eggs on websites, the weight of an engine is prohibitive.
Custom rendering pipelines are easier to build from scratch than to force into an engine's architecture. If your game uses a non-standard rendering technique (a 2.5D raycaster, a voxel engine with custom marching cubes, a vector-based renderer, or a GPU-driven procedural world), building it in raw WebGL lets you design the pipeline around your specific needs rather than adapting your approach to fit an engine's assumptions about how rendering should work.
The Case for an Engine
Game engines exist because building games requires far more than rendering. A complete game needs asset management (loading, caching, and unloading textures, models, audio, and data files), input handling across keyboard, mouse, touch, and gamepad, audio playback with spatial positioning and mixing, physics simulation for collision detection and response, animation systems for skeletal meshes and UI transitions, a scene graph for organizing and culling objects, and often a UI system for menus and HUD elements. Building all of these from scratch is a massive engineering effort.
Development speed is the engine's strongest argument. A game engine lets you focus on game design, content, and gameplay rather than infrastructure. When you use Babylon.js, you get physics, audio, particles, and a debugging inspector for free. When you use PlayCanvas, you get a collaborative visual editor. When you use Phaser, you get sprite animation, tile maps, and input handling. The hours saved on infrastructure can be invested in making the game itself better.
Cross-browser compatibility is handled by engine maintainers. WebGL behaves differently across browsers due to varying implementations, driver bugs, and extension support. Engine developers test against all major browsers and patch around known issues. Raw WebGL developers must discover and work around these issues themselves, which is an ongoing maintenance burden.
Community and ecosystem provide tutorials, forums, asset libraries, and plugins that accelerate development. If you get stuck on a Three.js problem, thousands of answered questions and examples exist. If you get stuck on a raw WebGL problem with a custom renderer, you are largely on your own. The community factor multiplies development speed, especially for less experienced developers.
WebGPU migration is handled transparently by engines. Three.js, Babylon.js, and PlayCanvas are adding WebGPU backends that work with existing game code. Raw WebGL developers must write their own WebGPU migration layer or maintain two separate rendering paths, which is a significant engineering effort.
Decision Framework
Choose raw WebGL when your project meets multiple of these criteria: the game has a simple or custom rendering approach that does not benefit from engine features, file size must be under 100KB, you need precise control over every GPU operation for performance, the game does not need physics, complex audio, or a full input system, or the project is primarily a learning exercise in GPU programming.
Choose an engine when: the game has standard rendering needs (3D scenes with lighting, 2D sprites with physics), development time matters more than file size, you need physics, audio, and input handling, the team includes members who are not graphics programming specialists, or you want to target WebGPU in the future without rewriting the renderer.
A middle path exists: start with a thin wrapper library (TWGL, regl, OGL) that eliminates boilerplate while preserving GPU control, and add specific libraries as needed (glMatrix for math, Howler.js for audio, Hammer.js for gestures). This approach gives you more control than a full engine with less development effort than raw WebGL, and it keeps the file size moderate.
Practical Recommendations
If you are new to browser game development, start with an engine. Phaser for 2D, Three.js or Babylon.js for 3D. Learn to ship a complete game, including menus, audio, input, and polish, before worrying about low-level optimization. The rendering pipeline is only one part of a game, and the parts that engines handle for you (asset management, input, audio, cross-browser testing) are substantial engineering efforts.
If you are an experienced developer who wants to learn GPU programming, write a raw WebGL renderer as a side project. Build the triangle, add textures, implement lighting, create a camera system. The knowledge you gain will make you a better user of any engine, because you will understand what the engine is doing under the hood and why certain design decisions affect performance.
If you are building a commercial game, use an engine unless you have a specific, measurable reason not to. Engine overhead is a rounding error in the overall development cost of a real game, and the time saved on infrastructure pays for itself many times over.
Raw WebGL is valuable for maximum control, minimal file size, custom pipelines, and learning. Engines are valuable for development speed, cross-browser compatibility, and complete game infrastructure. Most projects should use an engine, and developers who understand raw WebGL make better engine users.