Interactive 3D in a talk

An example presentation, made with reveal.js

Tutorial: Create slides with interactive 3D

Outline

The demos of this talk are C++ programs (OpenGL 3.3), compiled to WebAssembly: each one runs in a frame of the slide, next to the text.

  1. A demo in the slide
  2. Settings and controls
  3. Values from the program

Click in a demo to turn it with the mouse; the arrow keys still go to the next slide.

1. A demo in the slide

A C++ program in the slide

  • A program in raw OpenGL 3.3, about 200 lines
  • Compiled to WebAssembly with Emscripten
  • Shown by the slide in an <iframe>
  • Set by the address of the frame: ?speed=0.2&tilt=25

The same program, another preset

  • The same build as the previous slide
  • Another address: ?speed=0.5&tilt=-30&background=dark
  • One build serves all the slides that show this demo

2. Settings and controls

A panel built from the program

  • The program declares its parameters, with their ranges
  • The page of the demo builds the panel from them
  • Each slider changes a uniform while the demo turns

Buttons in the slide

The buttons below are in the text of the slide, outside the frame.

Amplitude:

An ImGui window

  • Marching cubes on a scalar field, recomputed at each change
  • The interface is the ImGui window of the program
  • Its text is enlarged by the address: ?gui_scale=1.4

3. Values from the program

The slide shows a value of the program

Drag a blue point: the program computes the length of the curve, and the slide shows it.

Length of the curve:

Conclusion

  • A 3D demo in a slide is a web page in a frame
  • The address of the frame sets it, slide by slide
  • A panel, buttons in the slide or ImGui drive it during the talk
  • The program can send values back to the slide

The method, the code of these demos and of this talk: the tutorial Create slides with interactive 3D.