diff --git a/docs/core_classes/vec.md b/docs/core_classes/vec.md index 5cb6a218..d1417f8e 100644 --- a/docs/core_classes/vec.md +++ b/docs/core_classes/vec.md @@ -17,7 +17,7 @@ morph::vec v1 = { 1, 2, 3, 4 }; but you can do maths: ```c++ -morph::vec v1 = { 1, 2, 3, 4 }; +morph::vec v2 = { 1, 2, 3, 4 }; morph::vec v3 = v1 + v2; // element-wise addition ``` diff --git a/docs/visual/index.md b/docs/visual/index.md new file mode 100644 index 00000000..8ffd9dc3 --- /dev/null +++ b/docs/visual/index.md @@ -0,0 +1,6 @@ +--- +title: The visual scene +layout: page +permalink: /visual/ +--- +morphologica has a class called `morph::Visual` which sets up a graphical 'scene'. In \ No newline at end of file diff --git a/docs/visual/viz.md b/docs/visual/viz.md new file mode 100644 index 00000000..7d5746eb --- /dev/null +++ b/docs/visual/viz.md @@ -0,0 +1,10 @@ +--- +title: Visualization with OpenGL +layout: page +permalink: /viz/ +--- +morphologica uses OpenGL to draw graphics and text. In a way it's like a game engine for data visualization. Unlike a game engine, it uses very simple shaders and very simple graphics. Where a game would take artist-generated 3D models and render and animate these models, morphologica draws very primitive models out of triangles, which are generated at runtime. For example, to draw a hexagonal grid, it simply creates vertices at the corners of each hexagon, and a vertex in the centre of each hex, then renders lots of triangles. Each group of vertices forms an 'OpenGL model'. + +Before it can draw OpenGL models, morphologica needs an OpenGL context to have been set up. morphologica has a class called `morph::Visual` which sets up a graphical 'scene' and deals with the OpenGL context. By default, morph::Visual uses the library GLFW3 to create a Window and an associated OpenGL context for all the drawing (if you want two windows in your program, you'll need two morph::Visuals). + +Within your scene, you will then create one or more instances of a `morph::VisualModel`. This is the base class for a number of different classes that draw different kinds of objects. If you have a custom visualization need, you can derive your own class from `morph::VisualModel`. \ No newline at end of file