GL LabGraphics workspace C / C++ / OpenGL

My program

A blank canvas for your own C or C++ ideas.

my-program.cpp
Ln 1, Col 1Saved in this browserUTF-8
Compile & run locally

Graphics output

Your canvas is ready

Run a graphics program to see the result.

Ctrl + Enter

Console

Ready to compile
Welcome to GL Lab. Write your program or open a source file, then press Run.
The C/C++ compiler runs on your device. First use downloads about 20 MB.
GL Lab guide

Start with your code

This workspace runs real C and C++ code in your browser. Start a new program or open your own single source file.

  1. Open your code. Use New for starter source or Open for an existing program.
  2. Edit the C/C++ source. Changes save automatically in this browser.
  3. Press Run. Compiler errors appear in the console. Click the canvas before using keyboard or mouse controls.

Graphics compatibility

The browser runtime supports a teaching subset of legacy OpenGL, GLU and GLUT through WebGL, plus selected GLFW functions with browser callback loops. The compatibility guide lists supported functions and tested classroom examples. Desktop behavior and visual output can differ.

Supported functions and tested examples

This is a teaching compatibility runtime, not a complete desktop OpenGL installation. Unsupported functions produce compile/link errors or runtime diagnostics. Native operating-system APIs, multiple windows, and external C/C++ packages are not included. Browser rendering can differ from your desktop, particularly line patterns and lighting.

Standard output (printf and std::cout) appears in the console. For scanf or cin, open Input in the console and enter the values before pressing Run. Input is supplied once per run; it is not an interactive terminal.

Separate output window

Use the arrow icon above the canvas to open a live view in another tab or window. It mirrors the same running program and preserves its aspect ratio. Keyboard and mouse input work there too. Keep the editor tab open. The live view is limited to about 15 frames per second; the program continues at its own rate.

Keep your work

Your programs are saved in this browser. Download your source before clearing browser data or switching devices. Importing a file opens it as your personal program. Download and Copy mark the current source as backed up. When unbacked edits remain, the site requests a browser warning before closing or reloading. Browsers control that warning and may omit it, especially on mobile. Local drafts and the visible reminder provide additional protection. Your source is not uploaded to our server.

Shortcuts

Ctrl / ⌘ + Enter
Compile and run
Ctrl / ⌘ + S
Download source
Ctrl / ⌘ + /
Toggle code comment
Escape
Close this guide or a canvas menu

Credits

Compiler: LLVM/Clang via binji/wasm-clang. Editor: CodeMirror. Dependency licenses are included with the site.

Restore this example?

Your saved edits for this lab will be replaced by the original example.

Replace your program?

Keep a copy of your current source before opening another file.